Scanning
This is the procedure I use for scanning physical music into good PDFs. It requires a few tools:
- A good scanner
- ScanTailor Advanced
- Photo editing software for touch-ups, such as GIMP
- ImageMagick for converting photos to PDF
- PDFTk for merging PDFs
Important Note
Every colour printer embeds tracking information into printed pages that can be used to identify the printer that printed the document (and there are theories as to how monochrome printers could also achieve this). A logical extrapolation from this is that scanners also embed identifying information in scanned images; many techniques for this exist. As such, any scanned image should be post-processed before being posted anywhere public.
The best tool we have for this is threshdolding/colour indexing; luckily for us, print music is ideally suited to this:
- Inner pages are almost always entirely black-and-white
- Outer pages typically consist of only a couple colours These conversions are likely to be universally destructive of any hidden identifiers. Entirely aside from security concerns, they also reduce the output file sizes by orders of magnitude (for a concrete example, a 600 DPI colour cover went from 85MB to 400KB, a 200x reduction in filesize).
Other methods include downsampling (e.g. reducing colour cover pages to 100 DPI) and adding noise (e.g. running it through a half dozen JPEG compressions); in cases of colour pages with a few colours only, thresholding will still look much better than these.
1. Scan Pages
- Use the best scanner you have access to
- Use the maximum DPI (typically 600)
- Colour or grayscale, DO NOT USE BLACK AND WHITE
- ScanTailor is much better at dealing with grayscale, use it whenever possible
- Ideally, the scanning size should be 1” larger than your page
- Scan two pages at once if the scan bed will fit it
2. Preprocessing (Optional)
Using GIMP or similar:
- Remove scan lines on coloured pages
- Remove any pencil/pen markings, discolourations, etc.
3. ScanTailor
- Deskew is the most important step:
- Rotate to make horizontal lines straight; then
- Use the oblique slider to make vertical lines straight
4. Postprocessing (Optional)
Using GIMP or similar:
- Convert colour pages to indexed mode
Image -> Mode -> Indexed...- Check
Generate Optimium Palette Maximum number of colorsshould be at least the number of colours in your image, sometimes a couple more gives better results
This can also be done as preprocessing, but I prefer to do it after.
5. Convert to PDF
- Bulk convert all output files to PDF pages (doing it at once may run out of memory):
ls *.tif | parallel convert {} -density 600 {.}.pdf - Merge PDF files:
pdftk *.pdf cat output <the output file>