Mobileread
whiten gray paper in pdf?
#1  prom king 02-01-2021, 06:07 AM
I have some scanned papers with text in pdf and paper is kind of yellowed, so is there a way to somehow whiten the paper and perhaps blacken the letters and drawings?
Reply 

#2  Quoth 02-01-2021, 09:49 AM
ImageMagik

Loads of other tools

Though for security reasons I open the PDF in The Gimp at a required resolution. Each page is a layer. I then save as/Export as motion png in reverse order so the pages are correct. Then imagemagik can crop, darken text, brighten background, change from RGB to greyscale or 16 shades grey or 1 bit mono by reading mpng file and creating a pdf file.

Then the PDF pages turn about x10 faster too.

Some PDF readers can do this on the fly, but not the stock one on Kindle or Kobo.
Reply 

#3  Tex2002ans 02-01-2021, 05:33 PM
Quote prom king
I have some scanned papers with text in pdf and paper is kind of yellowed, so is there a way to somehow whiten the paper and perhaps blacken the letters and drawings?
ScanTailor Advanced is one of the best tools for this:

https://github.com/4lex4/scantailor-advanced/releases/tag/v1.0.16

What you'll need to do is split your PDF into individual images, then ScanTailor Advanced should be able to do the "unyellowing" and straightening and everything else.

I wrote about that last year in:
Reply 

#4  prom king 02-02-2021, 03:18 AM
OK I'm trying ScanTailor Advanced and I see it has some commands for fixing but can't find something like "unyellowing"

EDIT oh wait, I kind of figured it out, but still working on it.

EDIT I downloaded ImageMagik and I can load only one image at the time and it has commands like Transform> Crop, Chop, Flip, Flop...

Can this be done in photoshop on all images at once?

EDIT ok I solved it. I did it in Photoshop by using this tutorial
https://marckean.com/2011/12/18/use-photoshop-batch-to-process-all-photos-in-a-folder/
Reply 

#5  Quoth 02-02-2021, 12:04 PM
ImageMagik can convert ENTIRE book. But security prevent it (normally) using a PDF as source. So step one is open the PDF in The Gimp (or possiblly photoshop). Each page is a layer. Export in reverse order as a motion png, that's a PNG with a frame for each page, an mpng or mng.
ImageMagik will convert that to PDF.

or use https://www.mobileread.com/forums/sh...d.php?t=144711
Reply 

#6  Tex2002ans 02-02-2021, 08:49 PM
Quote prom king
OK I'm trying ScanTailor Advanced and I see it has some commands for fixing but can't find something like "unyellowing"
It's found under one of the final steps, 6 "Output" > Mode.

You can choose between:

There's a checkbox for "Equalize illumination" which will do what you want. (This "darkens the black" and "whitens the yellow".)

show attachment »

If you chose Black & White, you'll be done.

If you chose Color/Grayscale, there's another box under "Filling" > Color, where you can choose between:

That makes the background a solid, consistent color.

show attachment »

Quote prom king
EDIT I downloaded ImageMagik and I can load only one image at the time and it has commands like Transform> Crop, Chop, Flip, Flop...
ImageMagick is an advanced commandline tool.

(And depending on the PDF, you might create a huge mess on your hands.)

It is possible to split PDF pages into individual images though.

I wrote about that back in 2019, "Converting pdf to png images" (Post #2). (You'll probably want to use the mogrify command I wrote in that post.)

That's how I sometimes split PDFs -> PNGs. Then I can feed those through Scan Tailor Advanced if needed.
Reply 

#7  willus 02-04-2021, 09:48 AM
By default in “copy” mode, k2pdfopt auto-adjusts the contrast of each page and uses a gamma of 0.5 to help darken the text:

k2pdfopt -mode copy infile.pdf -o outfile.pdf

Command-line parameters impacting this are:
-cmax Adjust contrast
-g Adjust gamma
-s[-] Turn on [off] sharpening (on by default in -mode copy)
Reply 

#8  icq70610 04-05-2021, 07:59 AM
hi all,

to throw something in here that i use for exactly this purpose.

Noteshrink python

QT version:

https://github.com/clapautius/noteshrink-qt

Commandline:

https://github.com/mzucker/noteshrink

should fit your purpose extremely well.

\Pete
Reply 

#9  willus 04-07-2021, 09:52 PM
Quote icq70610
hi all,

Commandline:

https://github.com/mzucker/noteshrink

should fit your purpose extremely well.

\Pete
Cool piece of software. The author did an excellent page on exactly how it works, too--I might have to sneak this functionality into k2pdfopt.
Reply 

#10  Tex2002ans 04-08-2021, 03:19 AM
Quote willus
Cool piece of software. The author did an excellent page on exactly how it works, too--I might have to sneak this functionality into k2pdfopt.
Fantastic article.
Reply 

  Next »  Last »  (1/2)
Today's Posts | Search this Thread | Login | Register