how to enhance the text in this image

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?".
Posts: 4
Joined: 2019-06-04T14:15:20-07:00
Authentication code: 1152

how to enhance the text in this image

Post by aspenlin »

I have an image here: ... 8.jpg?dl=0

In order to get a good result from OCR I need to increase the contrast of this image to make the text in it stand out from the background.
I tried 'convert -brightness-contrast 0x50 bloodtest8.jpg bloodtest8_bright_contrast.jpg' but the result is not satisfying to me. Some of the text is more clear now but not all of them. Especially for those text in the corners. The result is in the link below. ... t.jpg?dl=0

Is there a way to achieve what I want? Thanks for your help.

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

Re: how to enhance the text in this image

Post by fmw42 »

try -lat

Code: Select all

convert bloodtest8.jpg -colorspace gray -contrast-stretch 1x0% -negate -lat 10x10+10% -negate result.png
If on IM 7, use magick rather than convert.

Please always provide your IM version and platform when asking questions, since syntax may vary.