Corner squares coord+size detection

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?".
vitsin
Posts: 9
Joined: 2012-06-12T15:12:41-07:00
Authentication code: 13

Re: Corner squares coord+size detection

Post by vitsin »

Please correct me if I'm wrong, but for the last method the offset is always +0+0:

# trim
convert negated.png -trim +repage negated_trim.gif

# print first row
convert negated_trim.gif[210x1+0+0] txt:

# ImageMagick pixel enumeration: 210,1,255,gray
0,0: (255,255,255) #FFFFFF gray(255,255,255) --- white
...

# Offset from orignal image
convert negated_trim.gif -format "%O" info:
+0+0


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

Re: Corner squares coord+size detection

Post by fmw42 »

Use

convert negated.png -format "%@" info:
or
identify -format "%@" negated.png

210x210+45+45


to get the trim offsets and size without having to do a trim without +repage. see http://www.imagemagick.org/script/escape.php

(Or do a second trim, but leave off the +repage and then get the geometry.)


see how I packaged it all compactly at http://studio.imagemagick.org/discourse ... 112#p85956
vitsin
Posts: 9
Joined: 2012-06-12T15:12:41-07:00
Authentication code: 13

Re: Corner squares coord+size detection

Post by vitsin »

hi,
2nd solution with pixel enumeration working great now!!!
Thanks a lot!
--vs
Post Reply