Re: image reduction script

2006-03-26 Thread Philippe Martin
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



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: image reduction script

2006-03-26 Thread Kamilche
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.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: image reduction script

2006-03-26 Thread Philippe Martin
Kamilche,

I am posting the code in another thread but am not certain that convert does
anything to the picture color depth ... still searching in the doc.

Philippe




Kamilche wrote:

> 
> To reduce the color depth of an image in PIL:
> im = im.convert(mode="P", palette=Image.ADAPTIVE)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: image reduction script

2006-03-26 Thread Philippe Martin
Thanks, 

I'll give it a shot.

Philippe



Kamilche wrote:

> 
> To reduce the color depth of an image in PIL:
> im = im.convert(mode="P", palette=Image.ADAPTIVE)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: image reduction script

2006-03-25 Thread Kamilche

To reduce the color depth of an image in PIL:
im = im.convert(mode="P", palette=Image.ADAPTIVE)

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: image reduction script

2006-03-25 Thread Philippe Martin
Larry,

I actually did not find what I needed in PIL (missed it ?) but found this
package quite usefull: http://www.imagemagick.org/script/index.php

Philippe





Larry Bates wrote:

> Philippe Martin wrote:
>> Hi,
>> 
>> I need to write a script to reduce the resolution/color depth of an image
>> (ex: .jpg) based on a target size.
>> 
>> The point is for the target picture to still be "understandable" - yet I
>> target getting down to 5K.
>> 
>> Are there libraries out there that could help me start ?
>> 
>> Thanks
>> 
>> Philippe
>> 
>> 
> Python Imaging Library (PIL).
> 
> http://www.pythonware.com/products/pil/
> 
> -Larry Bates

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: image reduction script

2006-03-24 Thread Larry Bates
Philippe Martin wrote:
> Hi,
> 
> I need to write a script to reduce the resolution/color depth of an image
> (ex: .jpg) based on a target size.
> 
> The point is for the target picture to still be "understandable" - yet I
> target getting down to 5K.
> 
> Are there libraries out there that could help me start ?
> 
> Thanks
> 
> Philippe
> 
> 
Python Imaging Library (PIL).

http://www.pythonware.com/products/pil/

-Larry Bates
-- 
http://mail.python.org/mailman/listinfo/python-list


image reduction script

2006-03-24 Thread Philippe Martin
Hi,

I need to write a script to reduce the resolution/color depth of an image
(ex: .jpg) based on a target size.

The point is for the target picture to still be "understandable" - yet I
target getting down to 5K.

Are there libraries out there that could help me start ?

Thanks

Philippe


-- 
http://mail.python.org/mailman/listinfo/python-list