http://www.imagemagick.org/Usage/crop/#trim
This documentation tells how to get information out of -trim but doesn't interpret it.
Code: Select all
convert out2.tif -bordercolor black -border 1x1 -fuzz 88% -trim info:-
out2.tif TIFF 1668x2715 1776x2969+1+113 8-bit sRGB 0.047u 0:00.017
What I want to do is get the final geometry of an image after a series of operations. This will happen inside a program so doesn't have to be in a single IM command, but that's always nice if it's possible.
This is the initial image:
After the series of operations I want to get a [w]x[h]+dx+dy coordinates and a rotation with respect to the original.
The first operation is a known initial crop value:
Code: Select all
convert input.tif -crop 1774x2967+336+1491 output.tif
The second operation I tack on is a deskew:
Code: Select all
convert input.tif -crop 1774x2967+336+1491 -background black -deskew 60% output.tif
The last operation is the -trim:
Code: Select all
convert input.tif -crop 1774x2967+336+1491 -background black -deskew 60% -bordercolor black -border 1x1 -fuzz 88% -trim output.tif
So what I want to end up with is the deskew angle to slightly rotate the inital image and the [w]x[h]+dx+dy coordinates of the final image within the original image. I know how to get the deskew angle by putting -print %[deskew:angle] null: at the end of my command, but I'm not sure how to combine that with the other information I need.
Any ideas? The original tiff image is here: http://ucblibrary4.berkeley.edu/~apollo ... /input.tif