Combining crop and compose in one line.
Posted: 2009-05-30T17:10:26-07:00
I've created a bash script to copy skinnier and skinnier segments from the center of one image, and paste them over another image. This creates a "barn door wipe" effect for use in a video. The relavant portion of the script is:
This works as I had hoped. However, since this is inside a loop the fact that it first writes the cropped image to a temp file (a png image) each time is inefficient. What I'd like to do is combine this all into one statement and skip writing the temp file. In looking at the documentation, I found the usage example for composites. However, in the example given the image created with the convert statement is used as the background, and I want this to be the foreground. I've played around with several different ways I thought might work with this, but so far no luck. Can anyone here suggest a way to do this? Thanks!
Code: Select all
convert $startimage -gravity center -crop $percent%x100% temp.png
composite -gravity center temp.png $endimage -quality $qual frame$counter$ext