0

enter image description here

Look at the picture above, it has many shapes similar black and some of it got mixed with the white background. I want to fix this and make it simply black.

For your information, this is a zoomed-in of a just one page, the entire thing is 604 pages, and all the texts (or letters) of all the pages have same issue.

Is there any program that fixes all of them at once (i.e. make it the color pure with no added shape, or almost pure)?

enter image description here

Note that the text is made of multiple colors, meaning that some letters are in orange, other in purple, other in blue, etc.

I mainly use GIMP for photo editing, but if there's ANY other program that can do this, then I'm fine with switching.

  • Brothers if you know how to answer or know someone that can answer please answer to tell them to answer... this is very important because I've been working on creating a high quality Tajweed Mushaf for my brothers (in islam) to watch it in my YouTube channel. If you search "Tajweed Mushaf" online you will find most of them have low quality. – Qatada Al-Mubarak Jun 13 at 13:17
  • Pardon my ignorance but can't you find a high quality PDF version anywhere? It's a book, am I correct? – Luciano Jun 14 at 12:08
  • It isn't just any book, it's a Mushaf, the best of all books. Actually, there are many types of Mushafs (They're different in handwriting and the color of the Mushaf, but the type I'm using uses colors for letters depending on certain rules of Tajweed). The high quality Tajweed Mushaf I could find was the one here: quranflash.com/books/Tajweed/?en&skin=textile&aff but it still isn't high enough, I want an even more high quality version because in my Youtube channel (youtube.com/channel/UCJv0STX-xSkapow54orIJ6g), the image will be zoomed in, thus requiring more details. – Qatada Al-Mubarak Jun 14 at 12:15
  • Also, for any question you have I'll be happy to answer in shaa Allah. – Qatada Al-Mubarak Jun 14 at 12:16
  • sorry, I can't open the link you sent (I don't have flash installed). But anyway, if you need it in such high quality you should perhaps consider searching for a digital version - there must be one with the text in vector format. – Luciano Jun 14 at 12:59
0

Why text is blurred? Reasons:

  • too low pixel resolution
  • it's a photo with bad lens or noisy image sensor or camera has moved
  • it's a perfect photo, but the photographed print or handwriting has had hard times
  • saved with high video or photo compression

Whatever is the reason, making it sharp again is possible either by reversing the blurring mechanism exactly or by finding what's written and rewriting it

Reversing the causes of the blurriness is a theoretical possibility, very rarely the reasons are exactly known or reversing is found by experimenting. Too low resolution, compression artefacts and noise are irreversible - nothing can fix them except rewriting. Sharpening with GIMP's or other filters generally can make edges sharper (at best), but they also can distort letters. Information will easily actually decrease and the text can be more difficult to read.

Finding the written content and rewriting can be done manually, but OCR (Optical Character Recognition) programs can greatly help. Some OCR programs want grayscale text and you very likely must delete or crop out all non-textual content.

OCR for handwriting is theoretically possible, but I have never seen it. All versions in my hands have been for printed texts.

Make a web search to find which OCR programs can handle your texts. I bet anything which is only for English with western writing styles are now useless.

Text sharpening and OCR has been discussed in GDSE several times. Here's one example: How do I convert images of a page of text to pure Black & White and sharpen the text?

ADD: Automatic processing with generally available photo editing software is possible if your case is easy one, i.e. no OCR is needed and there exists a filtering where exactly same set of adjustment commands produce acceptable result with every file. In this case a programmed script can walk through whole folder of files.

In different programs scripting is different. I have made only Photoshop ACTIONS. In PS one can record the processing of one file and then do the same for all files in a folder automatically. Photoshop allows also scripts which are written in a programming language. GIMP doesn't know recorded actions, but a single command can be repeated for all open files. Programmed scripts also can be run.

Programmed scripts cannot justify differences in the image content and make cleverly different adjustments, but they can take into the account such things as different pixel dimensions.

Search for GIMP scripting and Batch processing GIMP. Here's one of the results:http://osp.wikidot.com/gimp-scripts

OCR is a complex route. OCR produces plain text files. Making them needs manual tinkering page by page. All created files must be read and errors must be seen and corrected. Then the whole book must be manually recomposed page by page. OCR only partially replaces retyping, it doesn't recreate the pages. If you are extremely lucky, the whole job takes a week as full day job, probably much more.

The needed scripts: No idea, if a single proper filtering exists. Or maybe a few different ones and precessing the files in a few separate batches.

Conclusion I guess it's easier to buy a brand new printed or electronic book, if that's available. Here in far west copyright laws make sharing books expensive. If one wants to give copies to his friends, the only legal way is to buy as many copies as he wants to give. Making own copies (printed or files) for sale or giving for free without paying is here a theft and publishing detailed methods how to do it isn't accepted action in this site.

Part 2 The questioner added a link to one problematic PNG. The file really is made to keep the file size small. It obviously is PNG because that avoids JPG compression losses, but indexed color mode (to save space) somehow detoriates the anti-aliasing.

The resolution is low, but not inferior. If I tried to guess which is the x-height in pixels, I would say it's 24 px. A zoomed screenshot which show text quality:

enter image description here

I am sure it's not handwriting, it's printed or composed in a computer, some repeating shapes are far too identical to be drawn manually. It has low resolution only to keep the file small and making it possible to be red with no special software.

Of course I had to check does OCR extract anything from it. There are many online services which claim to be able to extract Arabic. Some of them showed much "unrecognized" , some seemed to be able to decipher more than 80% of words, but the result was wrong.

A sharpening attempt:

There's some noise in the provided PNG sample. It shows as stray grey pixels. Then there is some anti-aliasing done when the pixel resolution was reduced to WxH= 776x1050. Anti-aliasing (=making pixels which contain white background and the letter color as mixed) is a way to retain apparent smooth curves when the pixel resolution is reduced.

The image was has indexed colors which partially spoils the anti-aliasing, but it can still be useful to let software to guess where the original smooth and sharp edge was when the resolution was high or the writing was vectors.

The blurry areas around the letters are wide and spoilt by indexing, but they can be made at least subjectively thinner and less fuzzy.

Change the color from indexed mode to RGB, apply levels or curves to lift some light colors to white and dark colors darker. Colors will get stronger at the same time. You can get something like this:

enter image description here

Proper setting is a subjective compromise between readability losses and apparent solidity increase. I assume this is still readable and too much originally grey writings haven't vanished. It's a guess only, I cannot read Arabic.

But this is still far from vector sharpness. Inkscape has quite clever edge estimator in its Bitmap Tracer. I saved the level-adjusted PNG and imported it to Inkscape. There I made a black and white tracing. The treshold was adjusted until the result seemed to resemble proper writing (=a guess again).

enter image description here

It's black, but it can be used as clipping mask for the original bitmap image (Object > Clip > Set)

enter image description here

The SVG file is here https://www.dropbox.com/s/1m4d9lqj17whu8s/SVG_489.svg?dl=0

A closer look reveals that the apparent letter forms are a mix of sharp vector edges and non-uniform colors. The questioner told in a comment they are readable, but full solidity is the actual goal.

The vector shapes could be filled with solid colors, but making the original bitmap solid is still unsolved. Questioner's own idea "scaling to bigger pixel dimensions" can help and it should be tested.

Image Enlargening software try guess where sharp borders should be and avoid widening blurry edges. I know 2 such programs which both seem to guess usefully well. They are Smilla Enlarger (=freeware) and ON1 Resizer (=commercial). Here is tried ON1 Resizer plugin in Photoshop (after changing the color mode to RGB)

enter image description here

Pixel dimensions are now 500% of original. There's some greyness and non-uniformity at edges. I believe indexed colors have wiped off information.

Adjusting levels can reduce greys from black, but at the same time the colored areas suffer, apparent washing increases. There's also some false coloring to the edges of the black areas:

enter image description here

If the enlargened image is at first made to B&W with color mixer aiming for best contrast and the levels are adjusted after it, the colored areas can be got to the same as the black areas. This is, of course, useful only if Black&White is allowed. Grey writings still are grey:

enter image description here

As said the image is enlargened to 500%, its about 5000px high. Over 600 pages of this can be too much. Another reason to believe this is not especially useful is that small prints need different adjustments because white holes inside the black seem to turn grey:

enter image description here

You should decide the usefulness of enlargeners by yourself. Get Smilla enlargener or a trial of ON1 Resize. I do not believe the latter is available as trial separately because it would be too good opportunity for occasional users. It's also a part of their premium priced PhotoRaw package, which has trial. ON1's Resise is very old product, it has been available also as Genuine Fractals and Perfect Resize.

One thing where enlargening can be useful: Tracing to vector in Inkscape can produce more acceptable result. Check this: https://www.dropbox.com/s/fvtpw9sez9x7jlv/Tracing2.svg?dl=0

It's traced to BW without any other adjustments than enlargening to 500% and setting the BW treshold to a guessed value, about 70%

  • Comments are not for extended discussion; this conversation has been moved to chat. – Emilie Jun 17 at 2:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.