Freeware image rescaler to improve OCR
Thread poster: Ilya Razmanov
Ilya Razmanov
Ilya Razmanov
Russian Federation
Local time: 23:35
English to Russian
Feb 19

Greetings,
frequently I receive source files to translate as low resolution scans (supposedly I'm not the only one), so OCR software starts to complain and tell me to encrease the resolution. Sure enough, rescaling images using common algorithms like nearest neighbour, bilinear and bicubic doesn't help much (except for that OCR software stops moaning).
Recently I've got a weird idea of
... See more
Greetings,
frequently I receive source files to translate as low resolution scans (supposedly I'm not the only one), so OCR software starts to complain and tell me to encrease the resolution. Sure enough, rescaling images using common algorithms like nearest neighbour, bilinear and bicubic doesn't help much (except for that OCR software stops moaning).
Recently I've got a weird idea of using pixelart algorithms like Scale2x (https://www.scale2x.it/) for scaling up the low-res scans. Surely Scale2x was developed for a completely different area, but why not?
So I wrote some small utilities for that, and preliminary test show that they improve OCR results.
Utilities forementioned are available here:

https://github.com/Dnyarri/PixelArtScaling

and include single file Scale2x and Scale3x PNG image rescalers with GUI, similar ones in commandline variant, and batch processing ones to batch process selected folder (recursively).

Programs open PNG image files, scale them up 2 times (Scale2x) or 3 times (Scale3x), and save as PNG files.

Everything is written on 100% Python so can be run on anything (Windows or Unixes) having Python available. For Windows users, there are compiled exe files it Release section:

https://github.com/Dnyarri/PixelArtScaling/releases/tag/2024.02.18

and sourcecodes available for everyone.

Main disadvantage is that everything is written on 100% Python so is quite slow when it comes to large images in batch mode.

Anyway, so far it seems to give some advantage to me and may be worth trying to you. Constructive feedback is appreciated.
Collapse


Stepan Konev
Dan Lucas
brovxidfmgan (X)
Jorge Payan
 
Michael Beijer
Michael Beijer  Identity Verified
United Kingdom
Local time: 21:35
Member (2009)
Dutch to English
+ ...
cool thanks! Feb 19

I've bookmarked this as it is something that might actually come in handy on the future.

Michael


 
Ilya Razmanov
Ilya Razmanov
Russian Federation
Local time: 23:35
English to Russian
TOPIC STARTER
Always in motion future is ;-) Feb 20

Michael Beijer wrote:

I've bookmarked this as it is something that might actually come in handy on the future.

Michael


I'm not sure whether I will implement other rescaling algorithms of that weird "pixel art" class. They are specifically developed for scaling up old games graphics, and some of them, for example, use chromaticity info for ranking pixels "closeness". Since b/w text scans obviously have no chroma, trying to take chroma into account is likely to make things worse. Scale2x and Scale3x are not only simple, but seem to work well with images they are initially not intended to be used for. So for a while I'll stick with that, and only add some minor improvements (next release will contain more informative progress indication, but I still need to test it). Bugfixes are not expected, since I seem to have stepped onto every bug during development already


 
Daryo
Daryo
United Kingdom
Local time: 21:35
Serbian to English
+ ...
You should send them back Feb 22

Ilya Razmanov wrote:

Greetings,
frequently I receive source files to translate as low resolution scans (supposedly I'm not the only one), so OCR software starts to complain and tell me to encrease the resolution. Sure enough, rescaling images using common algorithms like nearest neighbour, bilinear and bicubic doesn't help much (except for that OCR software stops moaning).
Recently I've got a weird idea of using pixelart algorithms like Scale2x (https://www.scale2x.it/) for scaling up the low-res scans. Surely Scale2x was developed for a completely different area, but why not?
So I wrote some small utilities for that, and preliminary test show that they improve OCR results.
Utilities forementioned are available here:

https://github.com/Dnyarri/PixelArtScaling

and include single file Scale2x and Scale3x PNG image rescalers with GUI, similar ones in commandline variant, and batch processing ones to batch process selected folder (recursively).

Programs open PNG image files, scale them up 2 times (Scale2x) or 3 times (Scale3x), and save as PNG files.

Everything is written on 100% Python so can be run on anything (Windows or Unixes) having Python available. For Windows users, there are compiled exe files it Release section:

https://github.com/Dnyarri/PixelArtScaling/releases/tag/2024.02.18

and sourcecodes available for everyone.

Main disadvantage is that everything is written on 100% Python so is quite slow when it comes to large images in batch mode.

Anyway, so far it seems to give some advantage to me and may be worth trying to you. Constructive feedback is appreciated.


If you are given low resolution scans to work from, you should send them back and ask for either a .doc / .rtf file or a better scan. *The client is NOT always right*. If you never say anything, you make it "normal/acceptable" to send any rubbish scan to translators to work from. Also, many clients are blissfully unaware of the headaches they cause by sending crap scans, and will remain unaware unless they start getting feedback.

If you can read easily the text, there are good chances of making the text usable for OCR. If even you struggle to read the text, no point in wasting your time trying to make it digestible for OCR.

With even only mid-level software for image processing, you can try resizing combined with modifying contrast, playing with histogram curves etc. You need to experiment with varying parameters - there is no one universal solution. One surprisingly effective trick is to ADD (the right amount of) blur to the enlarged picture of the text and then increase contrast. May sound strange, but it does improve readability. Maybe even to the point that OCR starts liking it.

If you don't mind spending a lot of time on it, you could make OCR-friendly a lot of scanned texts - surely an interesting game for an imaging software user. But for me the first question, from the point of view of a translator, is why should you have to?


 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

Freeware image rescaler to improve OCR






Trados Business Manager Lite
Create customer quotes and invoices from within Trados Studio

Trados Business Manager Lite helps to simplify and speed up some of the daily tasks, such as invoicing and reporting, associated with running your freelance translation business.

More info »
Trados Studio 2022 Freelance
The leading translation software used by over 270,000 translators.

Designed with your feedback in mind, Trados Studio 2022 delivers an unrivalled, powerful desktop and cloud solution, empowering you to work in the most efficient and cost-effective way.

More info »