Automate masking, rotating, then cropping film scans

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
franciswilliams52
Posts: 1
Joined: 2017-08-26T19:17:25-07:00
Authentication code: 1151

Automate masking, rotating, then cropping film scans

Post by franciswilliams52 » 2017-08-26T21:06:58-07:00

We recently finished digitizing tens of thousands of film negatives as part of a historical preservation effort. Some of these scans capture the entire negative cleanly but others are "overscanned" (they include bits of the surrounding mask) or are slightly rotated. Here is an example that demonstrates both flaws (overscanned and slightly rotated): http://i.imgur.com/MVwECk9.jpg

We're now ready to begin processing these scans, making sure that each scan is oriented in a perfectly horizontal or vertical fashion and appropriately cropped. We've settled on using ImageMagick to help automate the task due to its versatility, active community, and strong reputation among fellow archivists. After reading through this forum, searching the web, and playing with ImageMagick ourselves, we still have several unanswered questions:
  1. What is the best way to programmatically remove (or mask with black) the portions of a scan that aren't a part of the original film frame?
  2. What is the best way to programmatically detect and then correct a slight rotation (usually within +/- 2 degrees) of the film frame?
  3. What is the best way to programmatically crop the scan such that the film frame is cleanly isolated from the mask with minimal wastage?
An example of the hypothetical above steps can be seen here: http://i.imgur.com/ldQqg7H.jpg

We've found the resources at http://www.fmwconcepts.com/imagemagick/ to be exceptionally well-written, and have had success using the unrotate script for #2. We also suspect the innercrop script from the same website will work well for #3, but have not tested it. But what about #1? And, taking a step back, is there a better way to do what we want to do?

OS: Linux 3.10.0-327.10.1.el7.x86_64
ImageMagick: ImageMagick 6.9.5-5 Q16 x86_64 2016-08-08

Post Reply