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.
Crop and not change DPI
Re: Crop and not change DPI
I had this issue generating gif images. Any other format, jpeg, etc., should work fine.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Crop and not change DPI
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
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Crop and not change DPI
nothing you do is changing the DPI resolution of the images. Perhaps the image file format does not allow it?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/