Reputation: 64
And I want to remove everything but the blue and red text (so I can do effective OCR) on the top left. I have tried a couple things, but none of them have worked very effectively.
Preferably using the convert
command.
Upvotes: 0
Views: 219
Reputation: 53071
Here is one way to do that. Basically, we color threshold on the blue color. Then color threshold on the red color. Then add the two threshold results together and multiply that by the input image. You can try modifying the color values to improve the result. See -color-threshold (only available in ImageMagick 7) at https://imagemagick.org/script/command-line-options.php#color-threshold and https://imagemagick.org/discourse-server/viewtopic.php?f=4&t=37620
Input:
magick twotone.png +write mpr:img \
\( \( mpr:img -color-threshold "rgb(0,0,90)-rgb(90,130,170)" \) \
\( mpr:img -color-threshold "rgb(95,0,0)-rgb(140,90,90)" \) \
-compose plus -composite \) \
-compose multiply -composite \
twotone_text.png
Upvotes: 3