Cropping information for a image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
vinkolar
Posts: 1
Joined: 2011-05-14T08:20:06-07:00
Authentication code: 8675308

Cropping information for a image

Post by vinkolar »

Hello all,
I have a image complete.tif with size 1228x567. A part of this image (with size 655x376) has pixels that correspond to an actual picture. Rest of the pixels have transparent background (no color). When I crop using

Code: Select all

convert complete.tif -trim cropped.tif
I get a cropped image of size 655x376.

Now, I need the information the co-ordinates of the bounding box of the picture inside the original image complete.tif. Is there any command that peeps through complete.tif and provides information about the bounding box for the actual picture? (say, "roll complete.tif by 10 pixels to the right and 50 pixels down to get the actual picture aligned to left-top corner")?

Thanks
Vinay
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Cropping information for a image

Post by fmw42 »

identify -verbose cropped.tiff

look at the page geometry and origin geometry

or use string formats http://www.imagemagick.org/script/escape.php

convert cropped.tiff -format -format "%X%Y" info:
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Cropping information for a image

Post by anthony »

See, Fuzzy/Blurred Trim for details.
http://www.imagemagick.org/Usage/crop/#trim_blur
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply