[Digikam-users] png huge

Marcel Wiesweg marcel.wiesweg at gmx.de
Mon Jan 18 18:40:28 GMT 2010


> I have another thing that puzzles me: I've set digikam to store images
> as png, and always wonder how or rather why it makes out of a 2 MB jpg
> file a 10 MB png file, even though the png compression is set to its
> highest rate. Does png mean to increase file size by 5? Where does the
> additional info, that couldn't be in the jpg file, come from?
> Please point me to the place where this is explained, in case it has
> been done already. I didn't find anything. Only the usual: jpg does
> lossy compression, png doesn't.
> But I see it maybe too simple: The jpg file has a limited amount of
> info - uncompressed in a sense, because it's the original from which
> the png file is made. The png file now takes this info and then gets
> compressed to the maximum possible - yet it's 5 times larger.
> 
> Do I see that right, or am I completely on the wrong track?
> When I make well readable screenshots e.g., the file size in png is
> minimal (just a few kB), yet the image looks crisp and clear. So png
> can be small, it doesn't have a tremendous overhead.

I also once had the belief that PNG offers good image compression rates.
It does not. But it is very fast.
PNG uses Deflate compression - it's basically ZIP. This is a general 
compression method, not developed for images. There is some prefiltering and 
for certain images PNG will give good results, but for others not.

JPEG and newer compression formats know that their data is an image. They 
operate in frequency domain, using discrete cosine transform or wavelet 
functions. The latter can also be lossless, that's not the point.

Now your question about "additional info": The PNG does not care about 
compression artifacts introduced by JPEG. JPEG lossy compression does not 
necessarily reduce encoding entropy for the Deflate algorithm. (Note that JPEG 
also includes lossless entropy encoding, after the first step of quantization 
in the DCT domain)

Sound can be an analogy(*). Imagine a continuous tone of 500Hz. You record it 
with 44k samples per second. With PNG, after some prefiltering, you would 
encode these samples with entropy encoding. With JPEG or Wavelet, you would 
get a table with "1" at 500Hz and "0" for all other frequencies. You then 
encode that info with entropy encoding.

Please correct any wrong info here.




More information about the Digikam-users mailing list