Page 1 of 1

Crop and not change DPI

Posted: 2012-02-01T09:34:01-07:00
by vascott1
Hello. I am trying to crop images but not change the DPI.. Whgat I am seeing is an image is 200dpi and then after I perform the crop, the cropped output is 72 dpi.. My code looks like this...

my $imageCrop = $image->Clone();

$imageCrop->Crop( $pixelsWide . "x" . $pixelsHigh . "+" . abs($pixelsLeft) . "+" . abs($pixelsTop) );

$result = $imageCrop->Write("$TempDir$file");

This is having a huge impact for my process so any help would be appreicated.

Thanks, Scott.

Re: Crop and not change DPI

Posted: 2012-05-30T09:21:16-07:00
by aporthog
I had this issue generating gif images. Any other format, jpeg, etc., should work fine.

Re: Crop and not change DPI

Posted: 2012-05-30T09:36:10-07:00
by fmw42
Seems to work fine in command line mode, IM 6.7.7.3 Q16 Mac OSX Snow Leopard


convert logo: -density 200 logo_tmp.png
identify -verbose logo_tmp.png
Image: logo_tmp.png
Format: PNG (Portable Network Graphics)
Class: PseudoClass
Geometry: 640x480+0+0
Resolution: 200x200


convert logo_tmp.png -gravity center -crop 300x300+0+0 logo_tmp_crop.png
identify -verbose logo_tmp_crop.png
Image: logo_tmp_crop.png
Format: PNG (Portable Network Graphics)
Class: PseudoClass
Geometry: 300x300+0+0
Resolution: 200x200

Re: Crop and not change DPI

Posted: 2012-07-18T00:02:26-07:00
by anthony
nothing you do is changing the DPI resolution of the images. Perhaps the image file format does not allow it?