Deskewing and Cropping Scans using ImageMagick
Posted: 2019-08-28T21:55:12-07:00
Version: ImageMagick 7.0.8-62 Q16 x64
Platform: W10
Attempting to deskew and crop scans of a CD booklet using ImageMagick.
Here's one image which I've been using as an example on which to build my one-liner - https://mega.nz/#!jIQD3aqC!PbjG4_Xaq-YP ... IUkaoQzOgM
So far I've been using something along the lines of;
The deskewing step works very well, however I've been unable to achieve good results on the cropping stage. When deskewing the image ImageMagick expands it and adds additional pixels to fill in the blanks (here white, but could be transparent as well). This may be interfering with the ability of -trim to crop the image.
In any case, -trim either;
- fails to crop any edges
- crops a single edge but not the others
- (upon raising -fuzz values) crops multiple sides but fails to accurately crop edges
Not exactly sure what the issue is, but I've tried a number of different alterations to -trim parameters without success. If anybody has any advice it would be appreciated.
Platform: W10
Attempting to deskew and crop scans of a CD booklet using ImageMagick.
Here's one image which I've been using as an example on which to build my one-liner - https://mega.nz/#!jIQD3aqC!PbjG4_Xaq-YP ... IUkaoQzOgM
So far I've been using something along the lines of;
Code: Select all
convert testscan.png -background white -deskew 80% -fuzz 40% -trim +repage edited_scan.png
In any case, -trim either;
- fails to crop any edges
- crops a single edge but not the others
- (upon raising -fuzz values) crops multiple sides but fails to accurately crop edges
Not exactly sure what the issue is, but I've tried a number of different alterations to -trim parameters without success. If anybody has any advice it would be appreciated.