[Image-SIG] Regarding image compression

Jim Tittsler jwt at onjapan.net
Tue Aug 4 07:19:15 CEST 2009


On 2009-07-28 02:52, Tejovathi P wrote:
> I have a JPEG image of size 25KB and I want to compress it to 15KB, But
> I want to keep the original height and width same and reduce the size of
> the image. Is there any easy way to achieve this? Please let me know.

You can try adjusting the 'quality' keyword argument of the save() 
method to save space.
   im = Image.open('original.jpg')
   im.save('other.jpg', quality=50)
I don't know of a way to hit your 15KB target in a single shot, but 
would try various quality settings until your size target is achieved.

http://www.pythonware.com/library/pil/handbook/format-jpeg.htm



More information about the Image-SIG mailing list