select only border!

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
hawkfx

select only border!

Post by hawkfx »

Hello friends.

I've an image like this:


[img=http://img31.imageshack.us/img31/2829/m ... adw.th.png]


I could convert with imagemagick to this:


[img=http://img31.imageshack.us/img31/5893/ok3.th.png]

Using:

Code: Select all


convert rapid.png -matte ( +clone -fuzz 8% -transparent rgb(176,108,80) ) -compose DstOut -composite info2.png
convert info2.png -normalize -threshold  100%   info.png


I want to select the border of the letters and just leave in black, the fill of the letters in transparent or white.

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

Re: select only border!

Post by fmw42 »

Sorry I don't understand what you want as the result? Is it just an outline of the letters? If so use -edge (see http://www.imagemagick.org/script/comma ... s.php#edge) after you current processing to make black and white.


convert ok3.png -background white -flatten -edge 1 -negate ok3_fw_e1n.png
Image
Last edited by fmw42 on 2009-06-10T11:10:58-07:00, edited 2 times in total.
hawkfx

Re: select only border!

Post by hawkfx »

I want something like this:


Image

Thanks!
hawkfx

Re: select only border!

Post by hawkfx »

Thank you very much, I really appreciate.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: select only border!

Post by anthony »

hawkfx wrote:

Code: Select all


convert rapid.png -matte ( +clone -fuzz 8% -transparent rgb(176,108,80) ) -compose DstOut -composite info2.png
convert info2.png -normalize -threshold  100%   info.png

This seems like a bit of a round about way of doing what seems to be background masking...

try this instead...

Code: Select all

convert rapid.png -fill white -fuzz 35% -draw 'color 0,0 replace' -fill black +opaque white info.png
or even more simply...

Code: Select all

convert rapid.png  -colorspace gray -normalize -threshold 20% info.png
If you really want to use the color (foreground) you provide then do this.

Code: Select all

convert rapid.png -fill black -fuzz 8% -opaque "rgb(176,108,80)" -fill white +opaque white info.png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply