View Single Post
Old 03-05-2021, 08:29 PM   #223
Tex2002ans
Wizard
Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.Tex2002ans ought to be getting tired of karma fortunes by now.
 
Posts: 2,306
Karma: 13057279
Join Date: Jul 2012
Device: Kobo Forma, Nook
Quote:
Originally Posted by Ashjuk View Post
I don't know what application you are using but I downloaded what is supposedly the number 1 free lossless compression tool - PNGGauntlet - and running one of my uncompressed images through it resulted in an almost identical file size to the original.
TruePNG is what I used to get the ~22% further compression. It was an older tool created by the same guy who created ScriptPNG.

In ~2017, he obsoleted those 2 PNG optimizers and made:

pingo + pinga (a GUI version), which handles JPG/PNG/WEBP/APNG/[...]:

https://www.css-ig.net/pingo

I haven't used this program much though.

pingo's focus is on extremely high speed + fantastic compression.

Where TruePNG had extreme compression, even if it took a MUCH longer time.

Side Note: I actually just tested pingo, and it's absolutely fantastic. Blows away TruePNG.

He's really done a fantastic job making it even better.

(Of course, when optimizing, always make backup copies just in case, it overwrites the original files.)

Quote:
Originally Posted by Ashjuk View Post
I'm not saying you are wrong as you obviously have much more knowledge and experience than I, but following the above suggestions has not worked for me.
And again, the fantastic thing about lossless images is you'll get out EXACTLY what you put in.

It's just like zipping up a Word document:

You wouldn't want all your letters to get completely scrambled when you zip it up! (Lossy)

You want every letter in its exact same spot! (Lossless)

When you take an image with millions of colors and smush it into 256 (Indexed)... it's like you're taking all of your Unicode text and trying to smash it into ASCII:
  • résumé the crème brûlée (Unicode)
  • resume the creme brulee (ASCII)
  • αβγδεζηθικλμνξοπρστυφχψω (Unicode)
  • abgdezethiklmnksoprstufchpso (ASCII)

JPG/lossy conversion is like you're throwing away all the accents + trying to pick English letters that LOOK similar to the Greek.

Sure, it may look "close", but you'll never get back to the original.

Quote:
Originally Posted by Ashjuk View Post
I have just tried another compression tool - PngOptimizer - on the largest of the image files (tutorial-main-window.png) and the optimised file was approximately 10% smaller.

Whilst there has been some saving in my mind it is not that significant, and less than half of the ~22% you had mentioned.
Most of these tools go for speed + easy wins over super compression.

Imagine it like a ZIP file.

When you compress, you can usually move a slider from:
  • "No compression" -> "Maximum compression"

The higher the compression, the smaller the filesize. BUT it takes longer to gather all the data and figure out the best way to shrink it.

Imagine these PNG optimization tools like a hidden:
  • "Even maximum-er-er compression"

But even here, you have:
  • different quality tools (most stink)
  • diminishing returns
  • super duper new techniques
    • Like in 2013 Google came up with a newer compression algorithm (Zopfli). It's able to compress PNGs ~10% further, but at the cost ~80 times more CPU time.
    • For example, if PNGGauntlet's latest release was 2012, there's no way it even has this technique in there.

- - - - - - -

Basics of Lossless Compression

Simple Compression

For example, let's say you have a string of 100 1's:

Code:
1 1 1 1 1 1 1 1 1 1 1 1 [...] 1
Instead of storing all 100 numbers, you could instead say:
  • "put 100 ones in a row here"

Slight Compression

Let's say you saw this pattern:

Code:
1 2 3 4 5 6 7 8 9 10 11 12 [...] 100.
the PNG can say:
  • "Start at 1, and keep adding 1 for the next 99 positions."

More Complicated Compression

PNG has a ton of other methods to compress images like this that aren't normally used...

Like instead of only searching for patterns by row/column, it can also look diagonally + weird shapes like a 'z' + entire blocks at a time.

It can also do funky things with the math to get the same exact answer in the end.

Example: Simple Image

Let's say you had a B&W image with an all white background with a single black pixel in the middle.

The PNG would look something like this:

Spoiler:
Code:
255 255 255 255 255 255 255
255 255 255 255 255 255 255
255 255 255 255 255 255 255
255 255 255 0   255 255 255
255 255 255 255 255 255 255
255 255 255 255 255 255 255
255 255 255 255 255 255 255


255 = pure white
0 = pure black

(Note: In reality: RGB = 3 colors, so white would be "255 255 255" + black would be "0 0 0".)

Indexing the Image

A tool like pingo might look at the above and say:

"Hmmm, there are only 2 colors here. Let me Index this."

Spoiler:
Code:
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 0 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1
1 1 1 1 1 1 1


and let me say:

1 = the color white
0 = the color black

(Note: And when you multiply everything by 255, you get an exact match of the original!)

Optimizing the Optimization

But then it can scratch its head, and go even one step further.

White is used 48/49 times, and black is barely used.

Spoiler:
Code:
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 1 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0


0 = the color white
1 = the color black

Now it can just say something like:
  • "this entire image is color 0... except one teeny dot."

Huge lines of zero compress INCREDIBLY WELL.

This PNG would barely take any space now.

So GIMP/Photoshop only try the easy stuff, even at "Maximum"... pingo and other optimization tools try more of the crazy tools in the toolbelt.

Last edited by Tex2002ans; 03-05-2021 at 08:52 PM.
Tex2002ans is offline   Reply With Quote