image reduction script

Philippe Martin pmartin at snakecard.com
Sun Mar 26 22:49:17 CEST 2006


Kamilche wrote:

> Be sure and use mode = P instead of RGB, like you have in your other
> code. P is for palettized images. Don't palettize if you're storing as
> JPG, only if you're storing as PNG or some other format that can handle
> 256 color images.


My problem is this:

1) If I use a save to jpg after a convert('P') I get an exception (what you
are refering to I assume)
2) If I use a save to png (I start with a jpg), then the (X,Y) size of the
output is much smaller than convert('RGB') and save to jpg - (and I want to
opposit: as small as possible in byte size and as large as possible in
(X,Y)  ):

*** SAME INPUT FILE.JPG *** 
***********convert('P') save to PNG
/home/philippe/tmp/tmprpdfEO is a 65x87 Raw PPM image with 256 levels
  Default gamma for ITRUE image is  1.00
  Building XImage...done
  Have adjusted image from 1.00 to display gamma of 2.20

Versus:
***********convert('RGB') save to JPG
/home/philippe/tmp/tmpYCLrQR is a 173x231 Raw PPM image with 256 levels
  Default gamma for ITRUE image is  1.00
  Building XImage...done
  Have adjusted image from 1.00 to display gamma of 2.20


Philippe






More information about the Python-list mailing list