Hi,
after I use -rotate or -deskew there are white corners in the image.
Example: http://imgur.com/8bZQ6
What I'd like to do is fill up those corners as best as possible... cropping is not an option.
I've quite like this solution I've found for rotation:
convert image.png -virtual-pixel Edge +distort SRT 10 out.png
Example: http://imgur.com/edMS0
But I'd also like something similar for -deskew. Any ideas how to do that?
So far the best I've come up with is using the border pixels...
Note: my implementation is wrong - it only takes the approximation of the left and right borders... it also uses some bash scripting.
convert image.png -background `convert image.png -resize 100x1! \( +clone -crop 1x1+0+0 \) +append -crop 2x1+99+0 -resize 1x1 txt:- | tail -1 | cut -b 30-50` -rotate 10 out.png
Example: http://imgur.com/4wDPO
So, any ideas how to best fill those pesky white corners, that also works with -deskew, and other transformations?
Background filling after rotation/deskew
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Background filling after rotation/deskew
Two solutions. Crop to just the internal area (ignore the outside parts), or somehow specify what it should be filled with.
EG background color (that is the white you see), or virtual-pixel specification (tiled, mirrored, edge replacated).
See Minor Photo Rotation
http://www.imagemagick.org/Usage/photos/#rotation
and Distort Affine Tiling
http://www.imagemagick.org/Usage/distorts/#affine_tile
with appropriate Virtual Pixel Methods
http://www.imagemagick.org/Usage/misc/#virtual-pixel
EG background color (that is the white you see), or virtual-pixel specification (tiled, mirrored, edge replacated).
See Minor Photo Rotation
http://www.imagemagick.org/Usage/photos/#rotation
and Distort Affine Tiling
http://www.imagemagick.org/Usage/distorts/#affine_tile
with appropriate Virtual Pixel Methods
http://www.imagemagick.org/Usage/misc/#virtual-pixel
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/