Page 1 of 1

Separate the red and black texts into 2 graphic files

Posted: 2016-09-07T00:11:43-07:00
by philhung0704
Hi All,

I am new to ImageMagicK, I have a image with 2 color texts, one is black and the other is red
is it possible we can use ImageMagicK to separate these 2 color texts into 2 bmp files??

Code: Select all

convert d:\de\2pages.bmp -fuzz 45%% -fill white +opaque red d:\de\2pages_red_45.bmp
I tried the above code, you can find the image files from the below links.
you can see the texts with distortion after conversion.

the original image
https://drive.google.com/file/d/0B_bGsy ... sp=sharing

the converted images
https://drive.google.com/file/d/0B_bGsy ... sp=sharing
https://drive.google.com/file/d/0B_bGsy ... sp=sharing

is it any other way, for example, we can "detect" the red texts and "chop" this area saving as a image file??

thanks for your help in advance!!!!

Re: Separate the red and black texts into 2 graphic files

Posted: 2016-09-07T03:42:36-07:00
by snibgo
philhung0704 wrote:I have a image with 2 color texts, one is black and the other is red
No you don't. The red and black characters have anti-aliasing of weird colours: orange, gray, cyan and so on.

EDIT: My point is that you can't do this simply by colours, because you don't know if a gray pixel belongs to the red text or the black text.

So you need to define more precisely what you need to do.