Getting Cordinates ???

Magick++ is an object-oriented C++ interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick++.
Post Reply
arjuncbe
Posts: 2
Joined: 2011-10-03T05:44:49-07:00
Authentication code: 8675308

Getting Cordinates ???

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Getting Cordinates ???

Post 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.
arjuncbe
Posts: 2
Joined: 2011-10-03T05:44:49-07:00
Authentication code: 8675308

Re: Getting Cordinates ???

Post 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
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Getting Cordinates ???

Post by magick »

Look for magick/annotate.c/RenderFreetype()/OutlineMethods and FT_Outline_Decompose().
Post Reply