[Digikam-users] png huge

Geert Janssens janssens-geert at telenet.be
Tue Jan 19 17:19:12 GMT 2010


On Tuesday 19 January 2010, Martin Senftleben wrote:
> Hi,
> 
> with the many replies to my question I still believe I haven't been
> understood properly, even though I am very grateful for the replies
> which helped me to understand things better.
> 
> I recall the situation or my question:
> from a jpg image file, a png image file is created. The jpg file can
> contain only what is stored in it, right? The compression method is
> lossy, so whatever is stored in there isn't complete already. This is
> also - in my view - proven by the png that results when I transfer the
> jpg file to the png format: they look absolutely alike, the png image
> is in no way better than the "original" jpg image, it's only about 5
> times larger.
> The source of the png file is not the original raw image, but the
> lossy compressed jpg file. Is it possible for the png to extract more
> from the jpg file than there is in it? Or is it actually possible to
> revert the compression made by the jpg format to get basically the raw
> image (I doubt that, because then the jpg format wouldn't have lost
> any of the original info)? If that's the case, I would understand, but
> so far I couldn't read that from your replies.
> 
In fact that is exactly what happens.

A compressed jpeg doesn't contain pixel definitions of your image. To display 
the image, the jpeg encoded data is used to reconstruct a pixmap (or 
"picture"), and this pixmap is displayed. This picture is not what your 
original picture was before the jpeg compression, but it resembles it.

This converted image will be much bigger than your jpeg compressed file. 
Others have illustrated this with numbers, I won't repeat that.

Now the conversion from jpeg to png follows the same route, although no 
display step is involved.

First the jpeg compressed data is used to reconstruct a pixmap or image. 
Remember, this image looks like your original image before the jpeg 
compression but it is not. And this image will be much larger than the 
compressed jpeg, because it contains information for every pixel in the new 
image.

The next step will convert this full image into the png data format. This step 
involves another form of compression that is much less efficient, but has the 
advantage of being lossless.

So it is normal that your png image is much bigger than the jpeg is is created 
from.

And the uncompressed raw images before jpeg/png compression, or after jpeg/png 
decompression will be even much larger than either. This raw information is 
what the computer uses to display the image or to print it or to manipulate it 
in any way. The jpeg or png or other formats are only used to store the image 
on disk.

I hope this adds some useful background information.


> Sorry if I appear a bit dumb on this...
> 
Not at all. It's a complicated matter.

Regards,

Geert




More information about the Digikam-users mailing list