image analysis / position and size of effectively used area

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
OTATAA
Posts: 2
Joined: 2014-07-20T06:05:34-07:00
Authentication code: 6789

image analysis / position and size of effectively used area

Post by OTATAA »

hi,
I'm new to imagemagick and would like to aks the gurus on how to do the following:

- I have to determine left-x,top-y and the size (height and width) of the
effectively used area inside a bigger image.
- means this "effectively used area" has a rectangular shape.
- effectively used = non-transparent area (or area that is not white)

actually the "trim" function performs a cool job. but I need to have the position of this
trimmed portion inside the original image. I'm fine with reading these values out of
any imagemagick log.

does anybody have an idea?

best
stephen
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: image analysis / position and size of effectively used a

Post by snibgo »

Code: Select all

convert in.png -format %@ info:
This gives you the width, height, x-offset and y-offset that would result from a trim.
snibgo's IM pages: im.snibgo.com
OTATAA
Posts: 2
Joined: 2014-07-20T06:05:34-07:00
Authentication code: 6789

Re: image analysis / position and size of effectively used a

Post by OTATAA »

cool. thanks to the guru!
stephen
Post Reply