PNG, and the deflate compression it uses, is usually pretty good at exploting redundancy. For example, this 18.1kB image only grows to 19.1kB when duplicated and concatenated:


By Contrast, it almost doubles in size to 35.7kB when the copy is mirrored before concatenation


I can't see why this is the case. From my understanding, the first stage of PNG compression, the filtering, shouldn't be able to make use of that redundancy in either of those cases. The second stage on the other hand, the deflate compression, shouldn't have a problem since most if not all of the duplicated parts should fit within it's 32 KiB sliding window size. (for reference the encoder I used was Google's zopflipng)

Why then can't PNG take advantage of the redundancy of that mirrored part?

  • What program are you using to make these comparisons? – Ovaryraptor Mar 1 '19 at 18:06
  • The concatenation was done in GIMP – Hohmannfan Mar 1 '19 at 19:14
  • 1
    Sorry, but only few of us have the math competency and knowledge you expect. Most of us can only make rephrasings of what you obviously have noticed: The reduction algorithm can see exact repeatings but not anything which need a math transform before there's same pattern twice. You should ask elsewhere for exact explanations in math terms. – user287001 Mar 2 '19 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.