imagemagick resizing and quality PNG

前端 未结 4 609
庸人自扰
庸人自扰 2021-02-02 11:29

In my application I need to resize and make the quality on PNG files poorer.

In full size the PNGs are 3100x4400px using 2,20MB disk space.

When running the fo

相关标签:
4条回答
  • 2021-02-02 11:50
    1. You can further reduce quality of PNG by using posterization:

      https://github.com/pornel/mediancut-posterizer (Mac GUI)

      This is a lossy operation that allows zlib to compress better.

    2. Convert image to PNG8 using pngquant.

      It reduces images to 256 colors, so quality depends on the type of image, but pngquant makes very good palettes, so you might be surprised how often it works.

    3. Use Zopfli-png or AdvPNG to re-compress images better.

      This is lossless and recommended for all images if you have CPU cycles to spare.

    0 讨论(0)
  • 2021-02-02 11:51

    After using imagemagick to resize, you can compress the image using pngquant.

    On mac (with homebrew) brew install pngquant then:

    pngquant <filename.png>
    

    This will create a new image filename-fs8.png that is normally much smaller in size.

    0 讨论(0)
  • 2021-02-02 12:03

    Help page says, that -quality option used with PNG sets the compression level for zlib, where (roughly) 0 is the worst compression, 100 - is the best (default is 75). So try to set -quality to 100 or even remove the option.

    Another method is to specify PNG:compression-level=N, PNG:compression-strategy=N and PNG:compression-filter=N to achieve even better results.

    http://www.imagemagick.org/script/command-line-options.php#quality

    0 讨论(0)
  • 2021-02-02 12:08

    I found that the best way was to use the

    - density [value] 
    

    parameter.

    0 讨论(0)
提交回复
热议问题