Imagemagick position and size of a sub-image -
problem description:
in imagemagick, easy diff 2 images using compare, produces image same size 2 images being diff'd, diff data. i use diff data , crop part original image, while maintaining image size filling rest of space alpha.
the approach taking:
i trying figure bounding box of diff, without luck. example, below script using produce diff image, see below. now, need find bounding box of red color part of image. bounding box demonstrated below, too. note numbers in image arbitrary , not actual values seeking.
compare -density 300 -metric ae -fuzz 10% ${image} ${otherimage} -compose src ${output_dir}/diff${i}-${j}.png
you asked quite while ago - found question today. since think answer might still of interest, propose following.
the trim option of convert removes edges same color corner pixels. page or virtual canvas information of image preserved. therefore, if run
convert -trim edpdf.png - | identify -
it gives you:
png 157x146 512x406+144+32 8-bit pseudoclass 2c 1.08kb 0.000u 0:00.000
and values looking (144,228), latter 406-146-32 because looked lower left corner whereas (+144+32) gives upper left corner.
Comments
Post a Comment