Page 1 of 1

Batch Converting/Standardizing Multiple Mixed Resolution Images

Posted: 2015-06-07T02:03:22-07:00
by thatoldfool
Good afternoon,

Situation:
I'm repairing a poorly scanned PDF in ScanTailor. Whoever scanned the book scanned over 3 separate sessions using at least 2 different DPI's.

Problem:
Mixed resolutions mean that page sizes appear to vary. I need to somehow batch convert a directory of images to a standard resolution and size.

Help me ImageMagick, you're my only hope!

Thanks in advance!

-tof

Re: Batch Converting/Standardizing Multiple Mixed Resolution Images

Posted: 2015-06-07T03:07:07-07:00
by snibgo
I suppose each PDF page contains exactly one image?

Others here have more expertise at PDF than me, but I would try:

Code: Select all

convert -density XX in.pdf out.pdf
Choose XX to be the greatest scanning density used.

It may be better to do the job in stages:

1. Extract all the pages with pdfimages.

2. Resample as required to make them all the same dpi.

Code: Select all

convert page-0123.tiff -resample 300 out-page-0123.tiff
With luck, all the pages are now the same density and size (in pixels and inches). If they are not quite the same size, also use "-extent":

Code: Select all

convert page-0123.tiff -resample 300 -extent WWxHH out-page-0123.tiff
where WW and HH are the maximums.

3. Reassemble the PDF:

Code: Select all

convert out-page-*.tiff out.pdf

Re: Batch Converting/Standardizing Multiple Mixed Resolution Images

Posted: 2015-06-07T03:54:38-07:00
by thatoldfool
snibgo,

Bam, I combined your suggestions with a few others I read about here on the forum and my goal was achieved. Steps:

1. Export PDF to images
2. mogrify -path ~/Desktop/test/converted/ -format jpg -resample 300 -resize 3508x2480 *.jpg

resample on its own didn't do the trick for some reason.

Thanks for the suggestion! What an amazing programme...

-tof