Hello all,
I have just learnt to use gimp in batch processing mode to autocrop a directory of JPG images which are scans of documents (music manuscript paper). I've used this in a Windows cmd shell.
I have A LOT of these directories of scans. A lot of them will crop nicely with "plug-in-autocrop" if the background from the scanner is white: the result is usually a remnant border of about 15 pixes of white around each edge of the image. That's fine.
However, when some of the smaller documents are scanned, within the thin white border around the JPG image there are also areas of black, grey-blue or off-white, presumably depending on how the scanner was setup and what was behind the document. Sadly, the scans do not conveniently provide a clean, autocropable background.
The manuscript papers are all a typical beige hue or off-white, and some (we're talking 1930s) are a richer, more orangy-beige than others.
Is there a relatively manageable way of detecting where the off-colour border ends and where the beige/orange/off-white paper begins so that I can automate this cropping using gimp-crop-image?
Perhaps sampling for a range of beige colours expected for the paper and thus intelligently detect the edge of the paper? Or would that be a total nightmare?
I am attaching an example JPG (one that doesn't have any music written on the manuscript paper).
Working this out from scratch, if it's even doable, would probably take me weeks of learning. Maybe someone has some similar scripts which could be adapted?
Michael
By the way, there is an alternatve. As all the scans are in the same orientation - any excess border is always to the right and to the bottom of the manuscript paper, is it possible to have a script that runs in the graphical user interface such that GIMP can bring up each image in turn from the folder, allow me to click on the bottom right corner of the paper and for GIMP then to crop and save to that corner, save the result, close it and and bring up the next image without lots of mouse clicks?
That would be perfectly acceptable.
I have just learnt to use gimp in batch processing mode to autocrop a directory of JPG images which are scans of documents (music manuscript paper). I've used this in a Windows cmd shell.
I have A LOT of these directories of scans. A lot of them will crop nicely with "plug-in-autocrop" if the background from the scanner is white: the result is usually a remnant border of about 15 pixes of white around each edge of the image. That's fine.
However, when some of the smaller documents are scanned, within the thin white border around the JPG image there are also areas of black, grey-blue or off-white, presumably depending on how the scanner was setup and what was behind the document. Sadly, the scans do not conveniently provide a clean, autocropable background.
The manuscript papers are all a typical beige hue or off-white, and some (we're talking 1930s) are a richer, more orangy-beige than others.
Is there a relatively manageable way of detecting where the off-colour border ends and where the beige/orange/off-white paper begins so that I can automate this cropping using gimp-crop-image?
Perhaps sampling for a range of beige colours expected for the paper and thus intelligently detect the edge of the paper? Or would that be a total nightmare?
I am attaching an example JPG (one that doesn't have any music written on the manuscript paper).
Working this out from scratch, if it's even doable, would probably take me weeks of learning. Maybe someone has some similar scripts which could be adapted?
Michael
By the way, there is an alternatve. As all the scans are in the same orientation - any excess border is always to the right and to the bottom of the manuscript paper, is it possible to have a script that runs in the graphical user interface such that GIMP can bring up each image in turn from the folder, allow me to click on the bottom right corner of the paper and for GIMP then to crop and save to that corner, save the result, close it and and bring up the next image without lots of mouse clicks?
That would be perfectly acceptable.