Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get Photoshop's "Save for Web" quality with ImageMagick?

When I resize an image with photoshop's "Save for Web", it looks different than if I convert it with ImageMagick. Is there a setting I can change in ImageMagick to get same results as Photoshop? Here is an example.

The 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 so it's easier to see the difference:

Photoshop:

enter image description here

ImageMagick:

enter image description here

like image 440
rob Avatar asked Aug 28 '12 03:08

rob


2 Answers

The only immediate difference that's discoverable are these:

  • Photoshop's result is 76x86 pixels in size.
  • ImageMagick's result is 76x87 pixels in size.
  • Photoshop's number of colors used by the PNG is 378.
  • ImageMagick's number of colors used by the PNG is 401.
  • Photoshop's filesize for the PNG is 4.239 Bytes.
  • ImageMagick's filesize for the PNG is 3.410 Bytes.

I only know how to fix the first difference:

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

(This command's result has reduced the number of uniq colors to 358... but that's by accident only.)

As long as we don't know what other sort of filtering Photoshop's Save for Web... does apply, we have little chance to mimic its results exactly... You could try this:

convert orig.png -scale 76x86\! -interpolate bicubic scaled-76x86.png
like image 127
Kurt Pfeifle Avatar answered Nov 19 '22 20:11

Kurt Pfeifle


Check to see what re-sampling method (bicubic, bilinear, etc) you used in photoshop and make sure it's using the same method.

-interpolate type type being bicubic, bilinear, average, etc. Interpolation type

According to the docs Imagemagick uses bilinear by default, whereas Photoshop uses Bicubic by default.

like image 1
pdizz Avatar answered Nov 19 '22 20:11

pdizz