White Text on Black Background - OCR Prep Options

426 views
Skip to first unread message

Jeff Slenker

unread,
Sep 30, 2014, 5:26:31 PM9/30/14
to hon...@googlegroups.com
Hi All,

I am wondering about the experiences you have had with OCRing white text on dark backgrounds. After getting a bad OCR result with the original document, I discovered a way to convert an image of the text so that the text was black and the background was white and then OCRed the text successfully. This seems to be a rather convoluted process and I am wondering how the rest of you handle this situation.

Jeff Slenker

J>E
Memphis, TN USA

"Be kinder than necessary, for everyone you meet is fighting some kind of battle."

Dan Lucas

unread,
Oct 1, 2014, 2:54:01 AM10/1/14
to hon...@googlegroups.com
"I discovered a way to convert an image of the text so that the text was black and the background was white and then OCRed the text successfully. This seems to be a rather convoluted process and I am wondering how the rest of you handle this situation."
Hi Jeff. While I haven't run into this exact problem before, if I had a number of files that needed to be processed (resized, rotated, cropped, changed in colour etc) I would reach for the free software ImageMagick. While this can look intimidating, most of the time a simple command is all that is required. Changing the "white text on black background" image below to "black text on white background" required just one line:

convert dark.jpg -negate light.jpg

You could convert multiple files at once, set up batch conversions and so on. ImageMagick will also convert PDF files to graphics, cut and save parts of graphics files to other files - really almost anything you can think of can be done. It's not something I use every day but when I do need it, it's great to have in my toolbox.

Dan Lucas




Reply all
Reply to author
Forward
0 new messages