My input image has these specifications (Photoshop):
Width: 700px
Height: 500px
Document size:
Width: 18,52 cm
Height: 13,23 cm
Resolutation (DPI): 96
My output image has these specifications (using ImageMagick and Imagick and Photoshop to open them again):
Output ImageMagick:
Width: 729px
Height: 521px
Document size:
Width: 18,52 cm
Height: 13,23 cm
Resolutation (DPI): 100
Output Imagick:
Width: 700px
Height: 500 px
Document size:
Width: 17,78 cm
Height: 12,70 cm
Resolutation (DPI): 100
This is the code I'm using with ImageMagick (PHP):
Code: Select all
exec("convert -strip -units PixelsPerInch input.jpg -resample 100 -set density 100 output.jpg");
Code: Select all
$img = new Imagick('input.jpg');
$img->stripImage();
$img->setImageUnits(imagick::RESOLUTION_PIXELSPERINCH);
$img->setImageResolution(100,100);
$img->resampleImage(100,100,imagick::FILTER_UNDEFINED,1);
$img->writeImage('output.jpg');
$img->destroy();