Change book page background

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?".
Post Reply
dnorric

Change book page background

Post by dnorric »

Hi I download a number of books from archive.org. Most of them are direct scans and so the page color is quite yellow and old looking. I want to essentially change the page to white color. Is this possible. I know its a large feat but just thought there might be someone already done so.
Cheers
Damian
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Change book page background

Post by snibgo »

It certainly is possible, sometimes at the expense of legibility. Some of the books in there have already been thresholded, which introduces aliasing ("jaggies") into the edges of letters.

Often, a straightforward levels adjustment will do the trick well:

Code: Select all

convert in.jpg -level 10,70% out.jpg
You might also experiment with gamma and local adaptive thresholding (lat), and median. Optimum settings will vary with each book (and sometimes within a book). It might be easiest to experiment first with a GUI editor such as Gimp, then replicate the effect in IM, and do the batch conversion.
snibgo's IM pages: im.snibgo.com
dnorric

Re: Change book page background

Post by dnorric »

oh my god that worked brilliantly. Thankyou very much
dnorric

Re: Change book page background

Post by dnorric »

What im noticing now is that the text has lost definition and is a bit specally black and white. Does anyone know to solve this
Cheers
Damian
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Change book page background

Post by snibgo »

Post a link to an image, and to the "bad" result, and the command that created it.
snibgo's IM pages: im.snibgo.com
Post Reply