setimageresolution() query

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
BlissDirect
Posts: 9
Joined: 2016-05-06T08:44:15-07:00
Authentication code: 1151

setimageresolution() query

Post by BlissDirect »

Hello,

I have written under line of codes to convert image resolution to 300. Below code, does the trick and shows it in the properties of that image file, but when I open the same file in Adobe Photoshop, it shows the original resolution and not the changed resolution.

$image = new Imagick();
$image->stripimage('test.jpg');
$image->stripimage('image300.jpg');
$image->readImage('test.jpg');
$image->setImageResolution(300,300);
$image->resampleImage(300,300,imagick::FILTER_UNDEFINED,0);
$image->writeImage('image300.jpg');

Thanks in advance!
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: setimageresolution() query

Post by dlemstra »

It might be possible that one of the profiles contains that different image resolution. You could remove that with a strip and see what happens. But you might remove other profiles that you want to keep. It seems that you already call stripImage but that method has not arguments according to the documentation (http://php.net/manual/en/imagick.stripimage.php). And you should call that after you read the file.
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: setimageresolution() query

Post by fmw42 »

Perhaps deleting specific profiles may work. It is possible that it is in the 8bim or PS specific data.
Post Reply