Page 1 of 1

Deskew Text, maintain Text size & Original Dimensions...

Posted: 2018-10-24T03:27:38-07:00
by tackd
System; Linux Mint 18.3
ImageMagick 6.8.9-9 Q16 x86_64 2018-09-28

Source: US Letter Scanned Typed Letter (2550 x 3300 x 300 dpi)

Objective;
  • deskew
  • maintain original text size (no magnification)
  • resulting size same as original (2550 x 330 x 300dpi)
I have tried many incarnations, the most recent is;

Code: Select all

$ convert img20181022_0003.png -set option:deskew:autocrop true -sigmoidal-contrast 10,50% -deskew 40% +repage img20181022_0003_%02d.png
Could someone please advise ?

Thank you much.

Regards

Re: Deskew Text, maintain Text size & Original Dimensions...

Posted: 2018-10-24T04:40:13-07:00
by snibgo
See http://www.imagemagick.org/script/comma ... php#deskew . "auto-crop" needs a hyphen. Does that help?

Re: Deskew Text, maintain Text size & Original Dimensions...

Posted: 2018-10-24T16:12:39-07:00
by tackd

Code: Select all

convert img20181022_0003.png -set option:deskew:auto-crop true -sigmoidal-contrast 10,50% -deskew 40% +repage img20181022_0003_%02d.png
Original size: 2550 x 3300
Result size: 2452 x 3164

Does anyone know how to keep the original dimensions and size of the text unchanged after a deskew ?

Thank you.

Regards.

Re: Deskew Text, maintain Text size & Original Dimensions...

Posted: 2018-10-24T16:31:50-07:00
by snibgo
I don't see how you can have both.

Suppose you have scanned a piece of paper at an angle. The image will have more pixels than you need, added "triangles". After the deskew and auto-trim, those triangles will have been cropped off, so the image will be smaller than the scan.

You can "-extent" to make it the same size as the scan, if you want.

Re: Deskew Text, maintain Text size & Original Dimensions...

Posted: 2018-10-24T17:10:33-07:00
by tackd
Snibgo,

Thank you for your input.

After much experimentaion, and removing the "auto-crop", I added your suggestion, (-extent 2550x3300).

Code: Select all

convert img20181022_0003.png -sigmoidal-contrast 10,50% -deskew 40% -extent 2550x3300 img20181022_0003.tif
Result: 2550x3300 (Finally ! Thanks again)

Works, but I get an error "convert: TIFF: negative image positions unsupported"

Is it possible to maintain the original margin from the left of the page after a deskew ?
e.g. Original white margin, left side, 1 inch, before text begins.

Desired Result: 1 inch left margin before text begins, after the deskew ?

Regards

Re: Deskew Text, maintain Text size & Original Dimensions...

Posted: 2018-10-24T18:16:44-07:00
by snibgo
Is that an error or warning? Anyhow, I suggest you "+repage" after any deskew, crop etc, unless you know you don't want to.

"-extent" is sensitive to "-gravity". Perhaps "-gravity East" does what you want.

Re: Deskew Text, maintain Text size & Original Dimensions...

Posted: 2018-10-25T05:54:12-07:00
by tackd
Thanks for all your help snibgo.

I ended up with;

Code: Select all

convert img20181022_0003.png -filter catrom -sigmoidal-contrast 10,50% -deskew 40% +repage -gravity south -extent 2550x3300 img20181022_0003.tif
Best regards