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-YPhrPu1APaRmYLKmCSx6pxbIUkaoQzOgM

So far I've been using something along the lines of;

convert testscan.png -background white -deskew 80% -fuzz 40% -trim +repage edited_scan.png

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.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.