Page 1 of 1

Getting Cordinates ???

Posted: 2011-10-03T05:52:09-07:00
by arjuncbe
Hi all,
Great to see an active forum as this. I just got my hands on ImageMagick and Magick++.
I was wondering if its possible to get the list of co-ordinates of say a letter "A" drawn on a image.
If the background is white and the font color is black would it be possible to get the co ordinates of the black pixels alone in the image???
The reason why I need it is to draw dynamic shapes within the boundary of the letters.
Any help whatsoever is much appreciated.
Arjun

Re: Getting Cordinates ???

Posted: 2011-10-03T07:50:14-07:00
by magick
You can save the stroke path with this command:
  • convert xc: -stroke white -annotate +0+0 A path.mvg
which returns
  • path 'M5.57812,-3L6.45312,0L7.67188,0L4.67188,-9L3.25,-9L0.203125,0L1.35938,0L2.26562,-3L5.57812,-3M5.26562,-4L2.54688,-4L3.95312,-7.84375L5.26562,-4'
You are probably better off calling Freetype directly. See magick/annotate.c/RenderFreetype() to see how ImageMagick processes strokes.

Re: Getting Cordinates ???

Posted: 2011-10-18T04:45:34-07:00
by arjuncbe
Many thanks for the reply. However,
1) When I use the path below to draw, strangely I don't get the letter 'A' (I can see the bottom part of the letter in the top left corner, probably it has to do with the starting position)
2) I am trying to find the pixel co-ordinates actually (rather than the path to draw the lines and curves that form the alphabet) so is there a way to find the actual pixel co-ordinates of the stroke ???
3) I completely agree in calling Freetype directly but I am not able to spot the way to find co-ordinates from annotate.c.
Any thoughts???

regards
Arjun

Re: Getting Cordinates ???

Posted: 2011-10-18T05:07:17-07:00
by magick
Look for magick/annotate.c/RenderFreetype()/OutlineMethods and FT_Outline_Decompose().