Measurement between transparent images

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
markus71
Posts: 3
Joined: 2017-02-21T17:45:59-07:00
Authentication code: 1151

Measurement between transparent images

Post by markus71 » 2017-02-21T18:05:36-07:00

Hello,

We are looking for help with our Website Builder application.

We have integrated a measurement tool which shows the exact pixel difference between elements. Like text elements, images, etc.

If you download the image below:
https://www.dropbox.com/s/tkg14j2odt2u2 ... t.png?dl=0

You can see that the issue is that the two images are transparent png's with the same Background color as the page (black). Our measurement tool is measuring distances to the image container borders. What we want is to measure distance to the actual image within the black Background. We would need to breakdown the image properties in order to get the dimensions and then calculate the distance..

Any suggestions will be much appreciated.

Thank you,
Mark

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

Re: Measurement between transparent images

Post by fmw42 » 2017-02-21T18:59:48-07:00

Please do not post to two different forums. If your post in the Consulting Forum is not for PAID consulting, let us know and we will remove that post. I have moved this to the User's forum.

Your link is broken. I get a 404 Not Found Error.

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

Re: Measurement between transparent images

Post by fmw42 » 2017-02-21T19:04:55-07:00

I have copied your link over from your other post.

https://www.dropbox.com/s/tkg14j2odt2u2 ... t.png?dl=0

But there is only one image. So I am not sure about your comparison of two images?

The one image is a Forbes Wall Street Journal image and has NO alpha channel, so not transparent. Is that the correct image?

Please clarify what you need done with this image. Also please identify your IM version and platform.

markus71
Posts: 3
Joined: 2017-02-21T17:45:59-07:00
Authentication code: 1151

Re: Measurement between transparent images

Post by markus71 » 2017-02-21T19:16:49-07:00

Hi,

Thank you for your response. I created a quick video that should provide more clarification:
https://mark-onlybusiness.tinytake.com/ ... 80OTY1NDg3

You can see the distance measurement between the two images - "Forbes" and "The Wall Street Journal" You can see the distance measured (in orange) measures to the blue container of "The Wall Street Journal" where we actually want to measure it to the top of the letters "THE WALL' and the bottom of the letters "JOURNAL". So the WSJ image is transparent where it should be measuring to the words only not the container.

Hope this provides some further clarification :)
Cheers,
Mark

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

Re: Measurement between transparent images

Post by fmw42 » 2017-02-21T20:33:33-07:00

Sorry I cannot connect the audio with the image? The audio is also very hard to understand due to the echo. Your image from earlier is not transparent, so I am not sure what it is you want to have done. Please clarify further.

You might look at -morphology distance, if you want to measure distances in an image. See http://www.imagemagick.org/Usage/morphology/#distance

Otherwise, I do not see how Imagemagick will help you.

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

Re: Measurement between transparent images

Post by snibgo » 2017-02-21T20:55:49-07:00

The question is too vague for a meaningful answer. However ...

If an image has a solid-colour background, and contains elements of other colours (these elements being text or graphics or whatever), it is easy to find the horizontal or vertical distance between the elements.

There are many methods to do this. For example, make the background black and all other colours white, then scale the image to a single column. In this column, black pixels represent the vertical distance between elements, so these can be easily calculated.

But if you have a dozen elements and you want the vertical distance between two particular elements, how do you specify which elements are to be measured?
snibgo's IM pages: im.snibgo.com

Post Reply