<p>
I want to scan my Son's school books so that he doesn't get back problems lugging books to and from school. Something that for now at least remains <a href="https://en.wikipedia.org/wiki/Copyright_law_of_the_Netherlands#The_right_to_homecopy">legal</a> in the Netherlands.
</p>
<h3>Steps involved</h3>
<ol>
<li>Scan all the images using the entire length of your scanner. I use <a href="https://hackerpublicradio.org/eps/hpr2430/scantoimage.bash">scantoimage.bash</a></li>
<li>Confirm that there are no missing pages, and that every other page is upright and then upside down etc. If they are scan them and rename them so the name fits in between the pages</li>
<li>Back up all the scanned images</li>
<li>Manually crop the areas of the scans outside the area of the page. Usually this is on the side and bottom of the flat bed. Save is as something like ~/x.jpg</li>
<li>Use <a href="https://www.graphicsmagick.org/">GraphicsMagick Image Processing System</a> to identify the dimensions of the cropped image. <br />
<span style="font-family:'Lucida Console', monospace">
gm identify ~/x.jpg<br />
/home/me/x.jpg JPEG 2477x2609+0+0 DirectClass 8-bit 3.2Mi 0.000u 0m:0.000002s</span>
</li>
<li>Crop all the images to that dimension <br />
<span style="font-family:'Lucida Console', monospace">gm mogrify -crop 2477x2609+0+0 *.jpg</span>
</li>
<li>Rotate every second image by 180 degrees. <a href="https://hackerpublicradio.org/eps/hpr2430/rotate-every-second-image.bash">rotate-every-second-image.bash</a></li>
<li>Create a directory for the book and in there create a subdirectory for each section of the book. Manually copy all the images to the sub directory for that section. </li>
<li>Then go to the root where there are no files only subdirs and run the command <br />
<span style="font-family:'Lucida Console', monospace">for i in *;do echo $i;gm convert "${i}/*.jpg" "${i}.pdf"; done</span></li>
</ol>
<p>
At the end you will have a pdf file for each section of the book.
</p>