Issue
I want to annotate a counter on the top of a series of images each cropped of an image. I wrote:
crop=1050x"$height"+0+"$top"
loc=90x90+10+"$top"
time=$((time-1))
convert $image -crop "$crop" -pointsize 24 -fill white -undercolor '#00000080' -gravity North -annotate $loc "$time" "out/page_"$counter"_"$i".png"
This is called in a loop and the variable top increases. So, I can see the counter on the top of first output image but not on the rest. It seems it first draws the counter on the original image and then crop it, so the counter disappears after crop.
I tried to use a $loc
variable for the location of annotation but it also doesn't work!
Solution
When you "-crop" with ImageMagick you'll often need to add "+repage" right after the operation to set the paging geometry of the cropped piece(s) back to WxH+0+0. This can be important because some operations like "-annotate" will locate according to that geometry.
In your command, if you want the annotation the same distance from the top in every image, repage after the crop, and don't increment that distance with "$top" in the "$loc" variable. Just use the number of pixels you want the text to be down from the top.
Answered By - GeeMack Answer Checked By - Terry (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.