Page 1 of 1

Changing DPI result different quality (PS-IM)

Posted: 2014-02-10T04:02:15-07:00
by jeffreyg
I'm trying to change the DPI of an image to 100. Its a 300 DPI image. When I use Adobe Photoshop I get a different result when I change the DPI (Resolution to 100) then when I'm using ImageMagick with PHP.

I'm using ImageMagick-6.8.8-1-Q16-x86 and I used the -dll.-exe installer to get it installed properly. I use it on Windows 7 Ultimate 32-bit.

I use the following code to change the DPI of my image:

Code: Select all

exec("convert -strip -units PixelsPerInch  input.jpg -resample 100 -set density 100 output.jpg", $return);
I get the follow result (having photoshop to the left with 100 DPI (Resolution to 100) and ImageMagick with resample + density 100 to the right):

Image

Full image url: http://postimg.org/image/t265d59s9 (Press full size to see the difference better).

The original image I'm using can be found here:

http://onlyhdwallpapers.com/wallpaper/e ... 453029.jpg

The Photoshop result can be found here:

http://postimg.org/image/i1jf6xszb/

And the ImageMagick result can be found here:

http://postimg.org/image/yw1ahdw4d/

All the details are the same, when I both open them in photoshop. But there is a difference in quality between changing the DPI in Photoshop and ImageMagick. Is there any explanation why there is a difference between these 2? And how can I fix it to get ImageMagick giving me the exact same output as Photoshop?

Re: Changing DPI result different quality (PS-IM)

Posted: 2014-02-10T06:19:34-07:00
by snibgo
"-resample" changes metadata but also changes the size of the image. When Photoshop resizes, I've heard that it also sharpens. If you want IM to sharpen, you have to ask for it eg with "-sharpen" or "-unsharp". See http://www.imagemagick.org/script/comma ... hp#sharpen etc.

Re: Changing DPI result different quality (PS-IM)

Posted: 2014-02-10T07:37:32-07:00
by jeffreyg
Thank you very much! I've added it to my code and with a little bit of trying, the output looks more the same. Now I only have to try to find the right values but I'll manage that.