How to reduce PNG file size for web?

80,824

Solution 1

PNG is a lossless compression format -- without changing the source material in the file, there's very little way to increase compression beyond the default highest level compression. The only real way to reduce the size will be to change the image, either by reducing resolution, or colour depth so that the PNG compression has less complexity to work with.

If you want high levels of compression for the image and don't care about lossless data storage, use JPEG.

Solution 2

RIOT can do that, and a lot more.

Radical Image Optimization Tool (RIOT for short) is a free image optimizer that will let you to visually adjust compression parameters while keeping minimum file size.

It uses with a side by side (dual view) or single view interface to compare the original with the optimized image in real time and instantly see the resulting file size.

The image optimizer is lightweight, fast and simple to use, yet powerful for advanced users. You will be able to control compression, number of colours, meta data settings and much more, and select image format (JPEG, GIF or PNG) for your output file.

Another possibility is to use a combination of pngquant, pngout, and pngcrush, as described here, but this is from the command line.

Here are the instructions how to convert png24 images into png8 for ie6 goodness, all through the command line using open source tools (i think) pngquant +pngout + pngcrush.

1- quantize image into 256 (so basically png8′s look crap with large sprites or sprites with a large colour range).

pngquant 256 some_24_bit.png

2- convert image form a png24 to a png8

pngout -c3 -d8 -y -force some_24_bit.png some_8_bit.png

3- compress image

pngcrush some_8_bit.png -bit_depth 8 -brute -rem alla -reduce some_8_bit_small.png

Solution 3

Try TinyPNG

From their website:

How does it work?

When you upload a PNG (Portable Network Graphics) file, similar colors in your image are combined. This technique is called “quantization”. Because the number of colors is reduced, 24-bit PNG files can be converted to much smaller 8-bit indexed color images. All unnecessary metadata is stripped too. The result: tiny PNG files with 100% support for transparency.

They have two options:

  • Drag and drop the images onto their website and it gets automatically processed. Free service. (Up to 20 images. Max 5 MB each)
  • Photoshop plugin. This costs $.

I have not tried the PS plugin so can't comment on how well it works.

Solution 4

If you don't mind the command line, take a look at OptiPNG, it might be what you're after.

OptiPNG is a PNG optimizer that recompresses image files to a smaller size, without losing any information. This program also converts external formats (BMP, GIF, PNM and TIFF) to optimized PNG, and performs PNG integrity checks and corrections.

Solution 5

Use combination of pngout and deflopt. pngout will automatically determine if your PNG colors fit in PNG-8 and use it. deflopt will squeeze out some extra bytes from already optimized image - it is utility to work with any deflated data and PNG is one of those.

Share:
80,824

Related videos on Youtube

zac
Author by

zac

Updated on September 18, 2022

Comments

  • zac
    zac almost 2 years

    I have a PNG-24 file with transparent background and its current size is 1.5 MB. How to reduce size or use PNG-8 file format and keep same quality ?

    enter image description here

    PNG file from here: http://www19.zippyshare.com/v/69590430/file.html

    Example Image uploaded I tried all suggestions but no good results please advise

    thanks

    • Admin
      Admin almost 12 years
      You example image is a JPEG file. If you want people to try different tools/methods on it, you should provide one of you PNG file instead...!
    • Admin
      Admin almost 12 years
      site uploader converted it to jpg. here is the png file s8.postimage.org/z4apal6z9/cw_Copy.png .....please dont use posterize as it wont work with other files I have.....thanks
    • Admin
      Admin almost 12 years
      That link is also a JPEG.
    • Admin
      Admin almost 12 years
      this time I am sure it is png www19.zippyshare.com/v/69590430/file.html.......thanks for your help
  • zac
    zac almost 12 years
    Thanks but failed not much optimization !! I uploaded the image
  • Oleg V. Volkov
    Oleg V. Volkov almost 12 years
    Did you expect magic? Your image clearly have more than 256 colors. Posterize it to reduce amount of colors first.
  • zac
    zac almost 12 years
    When size reduced from 970 to 945 this is not good results also posterize does not work with other PNGs I have.
  • Kornel
    Kornel over 11 years
    I wouldn't say little. Photoshop's Save For Web is so poor that PNGOUT can often losslessly reduce files by 20-40%. And Photoshop doesn't support PNG8+alpha which can be 70% smaller for some images.
  • mikebabcock
    mikebabcock over 11 years
    The best numbers I've ever seen proven were around 8-15% but feel free to link me to better data.
  • Admin
    Admin almost 10 years
    I needed to optimize a single png file and used tinypng.com for that. It saved me more than 50% of space.
  • TripleAntigen
    TripleAntigen almost 7 years
    This was a really good tip, TinyPNG reduced my 24bit PNG file out of Photoshop, from 200k to 50k, and it retained blended transparency! Thanks for your reply. NOTE it was nearly indistinguishable in image quality.
  • Bruno Serrano
    Bruno Serrano over 6 years
    It really works! My 1MB PNG image became 253KB without loosing quality!