[Image-SIG] Creating a 187x250 thumbnail from this (CMYK) JPG results in a 1.91 MB PNG; 32-bit data written instead of reported 24-bit?
Charlie Clark
charlie.clark at clark-consulting.eu
Wed Jun 8 19:08:12 CEST 2011
Hi there,
Am 06.06.2011, 16:45 Uhr, schrieb C. Timmerman <ctimmerman2 at gmail.com>:
> Creating a max. 250x250 thumbnail from attached 3.55 MB CMYK JPG using
> PIL
> 1.1.7 results in a 1.91 MB PNG.
> Re-saving the thumbnail with even the lowest (0) compression and ASCII
> encoding in IrfanView 4.28 produces a much smaller file: 0.14 MB.
> Paint.NET 3.5.8 can create a 1.91 MB version by setting Bit Depth to 32.
> Comparing image info with IrfanView, PIL's PNG has blank DPI instead of
> 96x96, and 24 BitsPerPixel instead of 32.
Ouch! It is pretty impolite to post e-mails with such large attachments to
mailing lists.
I think the problem may simply be a misunderstanding for the .thumbnail()
method of images. From the docs:
"""
im.thumbnail(size, filter)
Modifies the image to contain a thumbnail version of itself, no larger
than the given size. This method calculates an appropriate thumbnail size
to preserve the aspect of the image, calls the draft method to configure
the file reader (where applicable), and finally resizes the image.
The filter argument can be one of NEAREST, BILINEAR, BICUBIC, or ANTIALIAS
(best quality). If omitted, it defaults to NEAREST.
Note that the bilinear and bicubic filters in the current version of PIL
are not well-suited for thumbnail generation. You should use ANTIALIAS
unless speed is much more important than quality.
Also note that this function modifies the Image object in place. If you
need to use the full resolution image as well, apply this method to a copy
of the original image. This method returns None.
"""
I read this to mean that the original image is preserved, and indeed, when
I open the PNG in Photoline I see something much close to the CMYK
original (no dayglow green). If you want a new image use resize()
Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Helmholtzstr. 20
Düsseldorf
D- 40215
Tel: +49-211-600-3657
Mobile: +49-178-782-6226
More information about the Image-SIG
mailing list