fill black color for an outline

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?".
Amused23
Posts: 20
Joined: 2015-09-24T22:48:39-07:00
Authentication code: 1151

Re: fill black color for an outline

Post by Amused23 »

My OCR accuracy is about 85% now. I can increase it to 95%-100%. The result of the commands in the previous post is the image below.
https://www.dropbox.com/s/0hmp1rc170l1j ... t.png?dl=0

The desirable result is the following image.
https://www.dropbox.com/s/g73qffwq7bm83 ... e.jpg?dl=0

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

Re: fill black color for an outline

Post by fmw42 »

try this:

Code: Select all

convert out.png -bordercolor white -border 1 \
-fill red -draw "color 0,0 floodfill" \
\( -clone 0 -fill white +opaque black -negate \) \
\( -clone 0 -fill black +opaque white \) \
-delete 0 -compose plus -composite -negate \
result.png
Amused23
Posts: 20
Joined: 2015-09-24T22:48:39-07:00
Authentication code: 1151

Re: fill black color for an outline

Post by Amused23 »

Nope...doesn't work.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: fill black color for an outline

Post by fmw42 »

The code works for me in IM 6.9.2.3 Q16 Mac OSX (unix syntax below)

input:
Image

Code: Select all

convert out.png -bordercolor white -border 1 \
-fill red -draw "color 0,0 floodfill" \
\( -clone 0 -fill white +opaque black -negate \) \
\( -clone 0 -fill black +opaque white \) \
-delete 0 -compose plus -composite -negate -shave 1x1 \
result.png
Image

If on Windows, see http://www.imagemagick.org/Usage/windows/ for syntax differences

P.S. IM 6.7.7.10 was not a good release. IM was undergoing significant color space changes. You should upgrade if you can. See viewtopic.php?f=4&t=21269
Amused23
Posts: 20
Joined: 2015-09-24T22:48:39-07:00
Authentication code: 1151

Re: fill black color for an outline

Post by Amused23 »

I upgraded to ImageMagick 6.8.9-9 Q16 x86_64 on my Linux box. It works...thanks a bunch!!
Post Reply