deskew
Posted: 2019-10-18T07:51:44-07:00
Hi all
I'm trying to deskew scanned images but weird things are happening. https://gofile.io/?c=ZgXVTY
here is my command
The main thing is the first command convert %1 -gravity center -crop 1000x1000+0+0 -deskew 40%% -format %%[deskew:angle] info: to detect the angle required.
Now I know my test image is skewed by 1.5 degrees. it's a yellow A4 page on black background. 300 dpi :
300_01.tif TIFF 2742x3756 2742x3756+0+0 8-bit sRGB 29.4659MiB 0.000u 0:00.000
1. If I run this i get a value of 0.111 degrees
2. If I crop the image to 1000x1000 and then run it on the newly cropped image I get 1.45 degree, correct.
3. If I remove the crop part of the command and run it on the original image i get 0.27 degrees.
4. if i remove the crop part of the command and run it on the crop i get also 1.45
So I can't inline crop ? , but when I do I get a different result to supplying an already cropped image. I don't want expensive temp files and read.write ops ? I thought I could do it this way with imagemagick ?
Also have tried a +repage after the crop but makes no difference.
I'm trying to deskew scanned images but weird things are happening. https://gofile.io/?c=ZgXVTY
here is my command
Code: Select all
FOR /F %%B IN ('convert %1 -gravity center -crop 1000x1000+0+0 -deskew 40%% -format %%[deskew:angle] info:') DO (
SET angle=%%B
echo angle %%B
)
convert %1 -rotate "%angle%" +repage %2
Now I know my test image is skewed by 1.5 degrees. it's a yellow A4 page on black background. 300 dpi :
300_01.tif TIFF 2742x3756 2742x3756+0+0 8-bit sRGB 29.4659MiB 0.000u 0:00.000
1. If I run this i get a value of 0.111 degrees
2. If I crop the image to 1000x1000 and then run it on the newly cropped image I get 1.45 degree, correct.
3. If I remove the crop part of the command and run it on the original image i get 0.27 degrees.
4. if i remove the crop part of the command and run it on the crop i get also 1.45
So I can't inline crop ? , but when I do I get a different result to supplying an already cropped image. I don't want expensive temp files and read.write ops ? I thought I could do it this way with imagemagick ?
Also have tried a +repage after the crop but makes no difference.