PIL and image file size
Christian Tismer
tismer at tismer.com
Mon Oct 7 15:31:30 EDT 2002
Fabrizio wrote:
> 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) !
...
> import Image, ImageDraw
>
> image1 = Image.open("My_image.jpg")
> # Resolution of My_image.jpg is 640x480
> image2 = Image.new("RGB", [660, 500], 0)
Note: 660*500 = 330000 ~= 330 kb.
Allow for another 18 KB for shipping and handling,
and you can see what happens......
> image2.paste(image1, (10,10))
>
> image2.show()
> image2.save('My_new_image.jpg',"JPEG", quality = 100)
......if you don't allow to compress the jpeg file !!! at all.
ciao - chris
--
Christian Tismer :^) <mailto:tismer at tismer.com>
Mission Impossible 5oftware : Have a break! Take a ride on Python's
Johannes-Niemeyer-Weg 9a : *Starship* http://starship.python.net/
14109 Berlin : PGP key -> http://wwwkeys.pgp.net/
work +49 30 89 09 53 34 home +49 30 802 86 56 pager +49 173 24 18 776
PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04
whom do you want to sponsor today? http://www.stackless.com/
More information about the Python-list
mailing list