PIL and image file size

Erik Max Francis max at alcyone.com
Mon Oct 7 21:35:58 CEST 2002

Fabrizio wrote:

> 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 ?

Presumably the reason is that you're saving the modified JPEG at the
highest quality setting.  Try the default quality setting and see what
the size ends up as.

The very fact that you're using JPEG might mean that you'll see some
artifacting with your black border; depending on what the original image
was, you might want to consider another format.

 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ I am a gentlemen:  I live by robbing the poor.
\__/ George Bernard Shaw
    Bosskey.net: Counter-Strike / http://www.bosskey.net/cs/
 A personal guide to Counter-Strike.

More information about the Python-list mailing list