PIL and image file size

Fabrizio facelle at libero.it
Mon Oct 7 15:09:53 EDT 2002


Hi,

I want to use PIL to add a black frame to my images.

The problem is that the size of the resulting pictures is much bigger that
the original ones; more than twice as much (e.g. 348Kb vs. 104Kb) !

Below is my code; what is wrong with it ?

TIA.

Fabrizio

---------------------------

import Image, ImageDraw

image1 = Image.open("My_image.jpg")
# Resolution of My_image.jpg is 640x480
image2 = Image.new("RGB", [660, 500], 0)

image2.paste(image1, (10,10))

image2.show()
image2.save('My_new_image.jpg',"JPEG", quality = 100)

------------------------------------------------------------

Filesizes :
My_image = 104Kb
My_new_image = 348Kb





More information about the Python-list mailing list