JPG - PNG conversion problem
Dietrich Epp
dietrich at zdome.net
Mon Feb 2 21:14:21 EST 2004
On Feb 2, 2004, at 9:32 AM, Raaijmakers, Vincent ((GE Infrastructure))
wrote:
> Yes I did.
>
> image.depth = 8
>
> But it didn't help, the 64k is the image file size having 256 colors.
160 * 120 = 19200
So something is wrong. First of all, PNG compressions is usually
around 2:1 to 4:1. JPG compression often still looks acceptable at
10:1 or higher. Second of all, depth is bits per sample. 8-bit RGB
takes up 24 bits per pixel. The depth is probably 8 already. What you
want to do is convert the image to indexed color.
My guess is the reason your file takes up 64k on your hard drive is
that your file system is rounding up to the nearest block. Try to find
out the exact number of bytes, it's undoubtedly smaller. Create a text
file on your drive that only contains one letter, then tell us what the
size is. Due to the type of compression that PNG uses, the worst case
scenario is a little more than 57k.
Now comes the part where I question your motives... what is wrong with
JPEG? Converting JPEG to PNG indexed is practically the worst case
scenario for image conversion. You get big file sizes, dithering, and
JPEG artifacts all in one image! I can think of worse conversions, but
they involve things like transmitting the raw image data over an RS232
connection without error connection up an elevator shaft.
More information about the Python-list
mailing list