Multiple crops from a single image rearranged to create a new image, one-liner with layers
Posted: 2016-05-11T22:16:04-07:00
I'm trying to take crops from a single image and rearrange them to create a new image.
Here's an example:
Before: http://imgur.com/Z6dLcvN.png
After: http://i.imgur.com/l6iBHbu.png
I was able to do this using:
However, I'd like to make it one command to avoid reading and writing to disk multiple times.
I was able to use -composite instead of -layers in one line, but my understanding is that -layers would perform better than -composite.
To get -layers working on one line, I tried this (and many, many other things including trying to use -clone), but I can't get anything to work:
My version is 7.0.1-3 Q16, Windows command line (syntax converted here for linux).
What am I missing? Thanks.
Here's an example:
Before: http://imgur.com/Z6dLcvN.png
After: http://i.imgur.com/l6iBHbu.png
I was able to do this using:
Code: Select all
convert balls_before.png -crop 170x170+57+50 ball1.png
convert balls_before.png -crop 170x170+257+50 ball2.png
convert balls_before.png -crop 170x170+257+235 ball4.png
convert \
-page 487x451+257+50 ball1.png \
-page +257+235 ball2.png \
-page +57+50 ball4.png \
-background white -layers flatten balls_after.png
I was able to use -composite instead of -layers in one line, but my understanding is that -layers would perform better than -composite.
To get -layers working on one line, I tried this (and many, many other things including trying to use -clone), but I can't get anything to work:
Code: Select all
convert \
-page 487x451+257+50 \( balls_before.png -crop 170x170+57+50 \) \
-page +257+235 \( balls_before.png -crop 170x170+257+50 \) \
-page +57+50 \( balls_before.png -crop 170x170+257+235 \) \
-background white -layers flatten balls_after.png
What am I missing? Thanks.