Page 1 of 1

Possible bug -deskew auto-crop IM 6.9.5.4 Q16 Mac OSX

Posted: 2016-08-01T20:16:59-07:00
by fmw42
The documentation says:

-deskew threshold{%}
straighten an image. A threshold of 40% works for most images.

Use -set option:deskew:auto-crop width to auto crop the image. The set argument is the pixel width of the image background (e.g 40).


Perhaps I am confused about what the -set option is supposed to do and what the width means (final image width or amount to trim). Nevertheless, I cannot get the -set option to work.

Base image:
Image

Rotate by 2 deg:

Code: Select all

convert lena.jpg -rotate 2 lena_r2.png
Image

Deskew no auto-crop:

Code: Select all

convert lena_r2.png -deskew 40% lena_r2_deskew.png
Image


Deskew with auto-crop assuming width is amount to trim (10)

Code: Select all

convert lena_r2.png -set option:deskew:auto-crop 10 -deskew 40% lena_r2_deskew_ac10a.png
Image

I also tried using -define rather than -set option (assuming there is an equivalent)

Code: Select all

convert lena_r2.png -define deskew:auto-crop=10 -deskew 40% lena_r2_deskew_ac10b.png
And also setting a background color (white):

Code: Select all

convert lena_r2.png -background white -set option:deskew:auto-crop 10 -deskew 40% lena_r2_deskew_ac10c.png
But none of the auto-crop commands worked.


P.S. If there is a -define equivalent, then please add to the -defines on the options page.

Re: Possible bug -deskew auto-crop IM 6.9.5.4 Q16 Mac OSX

Posted: 2016-08-07T12:58:28-07:00
by fmw42
Any work on confirming this issue?

Re: Possible bug -deskew auto-crop IM 6.9.5.4 Q16 Mac OSX

Posted: 2016-08-08T14:02:43-07:00
by magick
You can use -define deskew:auto-crop=10, we'll update the web page. When we used this option, here is the affine matrix it returned:
  • 0.999571 -0.0292843 0.0292843 0.999571 0 0
The results look reasonable.

Re: Possible bug -deskew auto-crop IM 6.9.5.4 Q16 Mac OSX

Posted: 2016-08-08T15:36:32-07:00
by fmw42
Neither -set option or -define crop the image on my IM 6.9.5.5 Q16 Mac OSX. I get the same result as if I had not added the -set or -define.

Re: Possible bug -deskew auto-crop IM 6.9.5.4 Q16 Mac OSX

Posted: 2016-08-08T16:48:42-07:00
by magick
The documentation is wrong. The deskew:auto-crop has a value or true or false.

Re: Possible bug -deskew auto-crop IM 6.9.5.4 Q16 Mac OSX

Posted: 2016-08-08T16:52:09-07:00
by fmw42
That changes things.

But in my test, it only trims off the extra white on the north and west edges. The results still show a white border on the east (right) and south (bottom).