Screenshot tools for Linux and macOS generally produce image files in the .png file format. PNG is a lossless compression format, meaning that it can be compressed without losing quality, which is unlike another commonly used image format, JPG. There are 3 command-line tools which can be used to compress PNG files, pngout, optipng, and advpng.

➜  pngout terminator-terminal-window.png 
 In:   11405 bytes               terminator-terminal-window.png /c6 /f5
Out:    8790 bytes               terminator-terminal-window.png /c2 /f5
Chg:   -2615 bytes ( 77% of original)
➜  optipng -o7 terminator-terminal-window.png 
** Processing: terminator-terminal-window.png
800x266 pixels, 3x8 bits/pixel, RGB+transparency
Input IDAT size = 8715 bytes
Input file size = 8790 bytes

Trying:
  zc = 9  zm = 9  zs = 0  f = 0		IDAT size = 8140
  zc = 9  zm = 8  zs = 0  f = 0		IDAT size = 8140
                               
Selecting parameters:
  zc = 9  zm = 8  zs = 0  f = 0		IDAT size = 8140

Output IDAT size = 8140 bytes (575 bytes decrease)
Output file size = 8215 bytes (575 bytes = 6.54% decrease)

➜  advpng -z4 terminator-terminal-window.png 
        8215        7232  88% terminator-terminal-window.png
        8215        7232  88%

Leave a Reply

Your email address will not be published. Required fields are marked *