Cannot get Imagemagick "Deskew" to work - ideas?
Posted: 2019-02-01T06:22:13-07:00
I am relatively new to Imagemagick but have successfully done the install in Ubuntu.
I have a question re: deskew, which I cannot get to work.
The situation:-
- Scanned 35 mm transparancies,
- These have Black borders of various sizes which I need to remove. – they are fuzzy to various degrees - AND the degree of blackness vs the edge of the photo varies hugely
- They are also skewed by random small amounts – and this is the issue.
… I cannot deskew the photos.
I can run commands such as this
mogrify -fuzz 35% -deskew 80% -trim +repage *.jpg
… which deals to some extent with the detection of fuzzy edges (I have to vary the fuzz value a bit), but what every deskew value I try… no actual deskew happens.
Any ideas what I am doing wrong?
Sample image here
https://www.dropbox.com/s/yuapprbv32jzw ... 9.jpg?dl=0
(Note this is a jpg just for this exercise as it’s easier to play with smaller files…)
Any ideas anyone?
My thoughts so far:-
Do we need to specify Imagemagick to only look for features to deskew at the edge of the photos?
There is also the issue with the contrast of the black border vs the edge of the photo – in a generally bright photo this will be high but in a dark scene the contrast is low so Imagemagick may have difficulty in picking up edges.
This is actually already evident in the trimming as I have to vary the fuzz value to avoid some photos being over or under trimmed.
So would it be a good idea for the first operation to do some sort of gamma adjustment to enhance the edge/photo contrast to artificially increase the contrast, then reverse this at the end?
(Just in case anyone wonders why I am resaving lossy jpgs, I am really dealing with uncompressed tifs but it’s much easier to experiment with small filesize jpgs…)
Many thanks
I have a question re: deskew, which I cannot get to work.
The situation:-
- Scanned 35 mm transparancies,
- These have Black borders of various sizes which I need to remove. – they are fuzzy to various degrees - AND the degree of blackness vs the edge of the photo varies hugely
- They are also skewed by random small amounts – and this is the issue.
… I cannot deskew the photos.
I can run commands such as this
mogrify -fuzz 35% -deskew 80% -trim +repage *.jpg
… which deals to some extent with the detection of fuzzy edges (I have to vary the fuzz value a bit), but what every deskew value I try… no actual deskew happens.
Any ideas what I am doing wrong?
Sample image here
https://www.dropbox.com/s/yuapprbv32jzw ... 9.jpg?dl=0
(Note this is a jpg just for this exercise as it’s easier to play with smaller files…)
Any ideas anyone?
My thoughts so far:-
Do we need to specify Imagemagick to only look for features to deskew at the edge of the photos?
There is also the issue with the contrast of the black border vs the edge of the photo – in a generally bright photo this will be high but in a dark scene the contrast is low so Imagemagick may have difficulty in picking up edges.
This is actually already evident in the trimming as I have to vary the fuzz value to avoid some photos being over or under trimmed.
So would it be a good idea for the first operation to do some sort of gamma adjustment to enhance the edge/photo contrast to artificially increase the contrast, then reverse this at the end?
(Just in case anyone wonders why I am resaving lossy jpgs, I am really dealing with uncompressed tifs but it’s much easier to experiment with small filesize jpgs…)
Many thanks