Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

imagemagick resizing and quality PNG

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 following command:

convert -resize 1400 -quality 10 input.png output.png 

the images are resized to 1400x2000 using 5,33MB disk space.

So my question is: How can I reduce the file size?

like image 740
jorgen Avatar asked Oct 27 '11 08:10

jorgen


People also ask

How do I resize an image in ImageMagick?

To resize an image to specific dimensions, use the convert command with an input file, the -resize parameter, your preferred dimensions, and an output filename: convert original. png -resize 100x100 new.

Is ImageMagick good?

If you're not sure what ImageMagick is, it's one of the greatest tools you could have on your computer, to manipulate images and a few other types of files.

What is ImageMagick legacy?

ImageMagick is free software delivered as a ready-to-run binary distribution or as source code that you may use, copy, modify, and distribute in both open and proprietary applications.

What is imagick used for?

ImageMagick, invoked from the command line as magick , is a free and open-source cross-platform software suite for displaying, creating, converting, modifying, and editing raster images. Created in 1987 by John Cristy, it can read and write over 200 image file formats. It is widely used in open-source applications.


1 Answers

  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.

like image 163
Kornel Avatar answered Sep 28 '22 00:09

Kornel