Tidying up straightened book pages

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, xnview

Post Reply
Daguerre
Posts: 22
Joined: Sat Oct 01, 2016 12:33 pm

Tidying up straightened book pages

Post by Daguerre » Sat Oct 01, 2016 12:55 pm

XnView 2.34 & XnConvert 1.70 running under Win 7 Professional x64 SP1.

I have a scanned book (jpeg files) and the pages are slightly skew. Auto Deskew in XnView does an excellent job of batch processing and straightening the pages but I would like to tidy them up by removing the narrow black triangles that the operation leaves on each side. At present I use XnConvert to crop a few pixels off each side but this does narrow the margins. Is there any way of making the black triangles white? I was hoping that changing the background colour from black to white would do the job, but I was wrong.

cday
XnThusiast
Posts: 2135
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Tidying up straightened book pages

Post by cday » Sat Oct 01, 2016 1:47 pm

Daguerre wrote:XnView 2.34 & XnConvert 1.70 running under Win 7 Professional x64 SP1.

I have a scanned book (jpeg files) and the pages are slightly skew. Auto Deskew in XnView does an excellent job of batch processing and straightening the pages but I would like to tidy them up by removing the narrow black triangles that the operation leaves on each side.
Presumably where new canvas has been added to maintain a rectangular image, otherwise could you please post a screenshot...
Daguerre wrote:Is there any way of making the black triangles white? I was hoping that changing the background colour from black to white would do the job, but I was wrong.
You changed the background colour using Edit > Background colour... in the viewer and there was no change? I would expect that to overcome the problem without actually testing it, but if it doesn't could you please upload an example image to test?

Daguerre
Posts: 22
Joined: Sat Oct 01, 2016 12:33 pm

Re: Tidying up straightened book pages

Post by Daguerre » Sat Oct 01, 2016 7:38 pm

As requested, here is an example. I hope it helps.
Attachments
3) 100 pixels cropped from each side.jpg
(2) Auto deskewed.jpg
(1) Original.jpg

Daguerre
Posts: 22
Joined: Sat Oct 01, 2016 12:33 pm

Re: Tidying up straightened book pages

Post by Daguerre » Sat Oct 01, 2016 7:43 pm

NOTE: The above figures are appearing in reverse order. The first one is the final cropped figure. The second one is the auto deskewed figure. The third one is the original figure, as scanned.

cday
XnThusiast
Posts: 2135
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Tidying up straightened book pages

Post by cday » Sat Oct 01, 2016 8:22 pm

Daguerre wrote:NOTE: The above figures are appearing in reverse order. The first one is the final cropped figure. The second one is the auto deskewed figure. The third one is the original figure, as scanned.
No problem for me using XnView Classic 2.36 with Edit > Background colour... set to white:

(1) Original_Auto_Deskewed.jpg
I don't know what could be causing your problem...

You might note that there may be a different way of achieveing the overall result you want: if you crop the page images inside the scan you can then resize the canvas to any desired size using Image > Canvas size... with both operations available as batch operations.

Book pages normally have different margin widths for left and right pages, but when I step through the pages of a scanned book on screen I prefer to see equal margins so that the pages stay centered, rather than jump alternately left and right.

Edit:

Here's a screenshot of my Background colour settings:

Image_2.png
Image_2.png (12.27 KiB) Viewed 588 times

Daguerre
Posts: 22
Joined: Sat Oct 01, 2016 12:33 pm

Re: Tidying up straightened book pages

Post by Daguerre » Sun Oct 02, 2016 11:07 am

Many thanks for the replies.

Yes, now I've discovered how to use it, resetting the canvas size seems to be the way forward. My procedure now is to straighten the pages in XnView with Auto Deskew, then tidy up the results in XnConvert with Actions set consecutively to Crop and then Canvas resize. With my current example I cropped 100 pixels of each of the 4 edges of the straightened image then reset the canvas size to the original values. I'm sure that if I could be bothered to do the trigonometry I would find a very small, and totally insignificant, change in the size of the text.

Re using a white background; I'll see if I can work out what I was doing wrong.

And, finally, can I just say that since I discovered XnConvert and XnView some while ago I am constantly amazed by their versatility - and I haven't even scratched the surface of the menus yet! And when it comes to batch processing they have so far solved all my problems. I could do a lot of the operations with my copy of Photoshop Elements 9, but only if I worked on a page at a time.

Phred
Posts: 25
Joined: Fri Nov 06, 2009 3:48 pm

Re: Tidying up straightened book pages

Post by Phred » Fri Oct 07, 2016 4:04 pm

I appreciate that you've done the image-capture already, but it might be worth starting again and saving yourself all the processing discovered here.
The vehicle I'd suggest your doing the job again with is Office Lens - an app. Windows Phone, iPhone, other.
It straightens up trapeziums that the camera sees, cleans up text, evens out contrast, and presents an orderly rectangle.
Hold your phone in a 'retort stand', place your book under it, and away you snap ...copyright notwithstanding.
Highly recommended.

Post Reply