Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: Compressing PNG Images

  1. #1
    Moderator Enterprise User Bhikkhu Pesala's Avatar
    Join Date
    May 2007
    Location
    East London
    Posts
    6,113
    OS
    64-bit Win 10
    CPU Cores
    1

    Question Compressing PNG Images

    I never cease to be amazed at the different file sizes I get with compression. It seems that every file is unique and the best method depends on the data being compressed.

    Often I find that a dialogue box saved with FastStone Capture (which has an option to set the PNG compression level to 9 (like IrfanView) gives the best results. Opening it in IrfanView and resaving it can increase the file size.

    Original 31,290 bytes saved from FastStone Capture at level 9. (Attached)
    Saved from IV at level 9 = 45,157
    Original compressed with PNG crush in 3 seconds = 31,290 bytes
    Original compressed with PNGOUT in 3 minutes = 41,285 bytes (sic)
    IV saved file compressed with PNG crush = 31,253 bytes
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Preferences Fonts.png 
Views:	470 
Size:	30.6 KB 
ID:	709  

  2. #2
    Power User j7n's Avatar
    Join Date
    Jun 2006
    Location
    Cyberspace
    Posts
    537
    Version
    IrfanView 4.51
    OS
    32-bit Win Server 2003 SP1
    CPU Cores
    1

    Default

    Simple screenshots are best compressible with no prefiltering. So, yes one should look at the picture if the goal is best compression. An 'intelligent' crusher could perhaps count the used colors.

    PNGOut, two passes = 32,912 bytes
    PNGOut, many passes = 32,235 bytes

  3. #3
    Moderator Enterprise User Bhikkhu Pesala's Avatar
    Join Date
    May 2007
    Location
    East London
    Posts
    6,113
    OS
    64-bit Win 10
    CPU Cores
    1

    Default

    I wonder why I get such poor resuts with PNGOUT. I tried resetting the defaults, but it is still giving significantly bigger files (44K), not smaller, than FastStone.

  4. #4
    Power User j7n's Avatar
    Join Date
    Jun 2006
    Location
    Cyberspace
    Posts
    537
    Version
    IrfanView 4.51
    OS
    32-bit Win Server 2003 SP1
    CPU Cores
    1

    Default

    IV saved file compressed with PNG crush = 31,253 bytes
    Only now I noticed this line. How is this possible? Is PngCrush lossy?

    To disable prediction filters, use command line parameter "/f0", or select "None" in the GUI version (IrfanView plugin).

    In the past I've made a request to make filters selectable without PNGOut. Coffee Cup HTML editor had them, I recall (but the option only worked in the save-for-web preview). This could be useful if absolutely best compression is not required.
    Last edited by j7n; 29.06.2008 at 01:56 PM.

  5. #5
    IV Beginner
    Join Date
    Nov 2007
    Posts
    56

    Default

    Bhikkhu,

    You may want to try:

    http://sourceforge.net/projects/optipng/

    optipng -o5 myfile.png

    or

    optipng -i1 -o7 -v -full -sim myfile.png -log myfile.log

  6. #6
    Moderator Enterprise User Bhikkhu Pesala's Avatar
    Join Date
    May 2007
    Location
    East London
    Posts
    6,113
    OS
    64-bit Win 10
    CPU Cores
    1

    Default

    Quote Originally Posted by j7n View Post
    Only now I noticed this line. How is this possible? Is PngCrush lossy?
    No. I tried with two files compressed by IrfanViiew using compression settings of 6 and 9 respectively without PNGOUT.

    Orignal saved from FastStone Capture
    Preferences Fonts.png = 31,290 bytes (using the Max setting = 9)

    Preferences Fonts 6.png = 46,469 bytes
    Preferences Fonts 9.png = 45,157 bytes

    PNGcrush gave the same result for both files

    Preferences Fonts 92.png = 31,253 bytes
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	Preferences Fonts 92.png 
Views:	250 
Size:	30.5 KB 
ID:	711  

  7. #7
    Moderator Enterprise User Bhikkhu Pesala's Avatar
    Join Date
    May 2007
    Location
    East London
    Posts
    6,113
    OS
    64-bit Win 10
    CPU Cores
    1

    Default

    Quote Originally Posted by dvipmail View Post
    Bhikkhu,

    You may want to try:

    http://sourceforge.net/projects/optipng/
    No thanks. Maybe you may like to try it on the attached file and post your results. We're getting off-topic, so I have split this thread to the Software Forum.
    Last edited by Bhikkhu Pesala; 29.06.2008 at 04:30 PM.

  8. #8
    Power User j7n's Avatar
    Join Date
    Jun 2006
    Location
    Cyberspace
    Posts
    537
    Version
    IrfanView 4.51
    OS
    32-bit Win Server 2003 SP1
    CPU Cores
    1

    Default

    I tried to capture a complex photorealistic image (my desktop) with FastStone, 30 days trial, Portable release.

    FastStone (default comp level): 1,473,431 bytes
    IrfanView (9): 1,322,886 bytes
    PNGOUT (no filter): 1,382,380 bytes
    PNGOUT (Paeth): 1,340,467 bytes

    Decompression speed in IV (probably need even bigger files to accurately compare):
    FastStone (default comp level): 63 milliseconds
    IrfanView (9): 94 milliseconds
    PNGOUT (no filter): 63 milliseconds
    PNGOUT (Paeth): 140 milliseconds

    This would indicate that FastStone is optimized for screenshots, and therefore use no prediction filters.

  9. #9
    Moderator Enterprise User Bhikkhu Pesala's Avatar
    Join Date
    May 2007
    Location
    East London
    Posts
    6,113
    OS
    64-bit Win 10
    CPU Cores
    1

    Default

    Try FastStone's Maximum compression level. The default is 6 as in IrfanView.

    BTW A free version of FastStone is still available from OldVersions.com. See my sig.
    FastStone Capture is an essential tool for me, so I have a licensed copy of the latest version.

    I found the filter options in FastStone and tried the Paeth filter on a photograph. Without it compression was much less than IV, but with it it was slightly better.

    FastStone Max No Filter = 4,750,841 bytes
    IV at level 9 = 2,999,839 bytes
    FastStone Max Paeth = 2,994,553 bytes
    IV at level 9 + Crush = 2,990,699 bytes

    All this goes to prove that you need to know a lot about the image data being comrpessed before deciding which method to use. Much too complex for the average user to consider all these variables.
    Last edited by Bhikkhu Pesala; 29.06.2008 at 07:56 PM.

  10. #10
    Power User j7n's Avatar
    Join Date
    Jun 2006
    Location
    Cyberspace
    Posts
    537
    Version
    IrfanView 4.51
    OS
    32-bit Win Server 2003 SP1
    CPU Cores
    1

    Default

    I don't see where to specify compression strength. "Preferences Fonts" sample comes out 31,272 bytes – smaller than PNGOUT's über deflate could produce. IrfanView really needs the filter option to catch up.

    PNGOUT takes too much time for the average user.

    It should be noted that "No filter" can in some cases compress more and less intensive filters (none < sub < paeth) take less resources during decompression. If an application requires thumbnails to be generated often, or the images are large this might become significant.
    Last edited by j7n; 29.06.2008 at 08:09 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •