How can I get Photoshop “Save for Web” using ImageMagick?

When I resize an image using Photoshop "Save for Web", it looks different than if I converted it with ImageMagick. Is there a parameter that I can change in ImageMagick to get the same results as Photoshop? Here is an example.

Original:

enter image description here

Save for Web 30.01%
vs
convert -geometry 30.01% home-button-full.png home-button-ipad.png

enter image description hereenter image description here

Enlarged to make it easier to see the difference:

Photoshop:

enter image description here

ImageMagick:

enter image description here

+4
source share
3 answers

The only instant difference that can be detected:

  • The result of Photoshop is 76x86 pixels in size.
  • The ImageMagick result has a size of 76x87 .
  • The number of colors used by PNG, <<22>.
  • ImageMagick the number of colors used by PNG is 401 .
  • Photoshop file size for PNG is 4.239 Bytes .
  • ImageMagick PNG file size is 3.410 Bytes .

I only know how to fix the first difference:

 convert orig.png -scale 76x86\! scaled-76x86.png 

(The result of this command reduced the number of uniq colors to 358 ... but this is by accident.)

As long as we don’t know what another type of Photoshop Save for Web filtering does ... we have little chance of accurately simulating its results ... You can try the following:

 convert orig.png -scale 76x86\! -interpolate bicubic scaled-76x86.png 
+5
source

Check which resampling method (bicubic, bilinear, etc.) you used in Photoshop and make sure that it uses the same method.

-interpolate type type, which is bicubic, bilinear, medium, etc. Interpolation type

According to the docs, Imagemagick uses a bilinear system by default, while Photoshop uses Bicubic by default.

+1
source

Try using the -quality option if you want to use lossy compression. By default, ImageMagick is set to 100 (lossless) for jpg.

http://www.imagemagick.org/script/command-line-options.php#quality http://www.simplesystems.org/RMagick/doc/imageattrs.html#quality

0
source

All Articles