overlaying multiple generated layers in one command
Posted: 2016-05-02T10:17:37-07:00
hi everybody
using imagemagick 6.7.7-10 on an ubuntu 14.04 LTS server i'm trying to create a single image from multiple layers in one command. i can create the layers in seperate commands, but i don't want to save all the layers as seperate files.
td;dr:
how can i write all these steps in a single (convert?) command without creating all the intermediate files:
i tried something like this - but it's not working at all (ends up with just a red image):
description with example images:
these are my base images:
area.jpg
line.jpg
these commands generate the layers:
area_color.jpg:
line_color.png (with transparent background):
then i can combine these layers to create the final image:
since i will be doing this in a loop with a lot of different colors, i need to find a way without writing all these intermediate layers out to files.
how far i got myself
i managed to reduce one step (without the -page and +repage) by creating the 'line_color.png' on the fly:
but i can't integrate the "area_color.jpg" generation into the seccond command. nor do the page/repage correctly.
any hints from the pros?
please?
using imagemagick 6.7.7-10 on an ubuntu 14.04 LTS server i'm trying to create a single image from multiple layers in one command. i can create the layers in seperate commands, but i don't want to save all the layers as seperate files.
td;dr:
how can i write all these steps in a single (convert?) command without creating all the intermediate files:
Code: Select all
# color background:
convert area.jpg -background '#f3cba3' -alpha Shape -background '#558eba' -alpha remove area_color.jpg
# transparent red outline:
convert line.jpg -negate -background '#CC0000' -alpha Shape line_color.png
# combine them with an offset:
convert area_color.jpg -page +10+10 line_color.png -flatten -crop +10+10 +repage final.jpg
Code: Select all
convert \
area.jpg -background '#f3cba3' -alpha Shape -background '#558eba' -alpha remove \
-page +10+10 \
line.jpg -negate -background '#CC0000' -alpha Shape \
-composite -crop +10+10 +repage final.jpg
description with example images:
these are my base images:
area.jpg
line.jpg
these commands generate the layers:
area_color.jpg:
Code: Select all
convert area.jpg -background "#f3cba3" -alpha Shape -background "#558eba" -alpha remove area_color.jpg
line_color.png (with transparent background):
Code: Select all
convert line.jpg -negate -background '#CC0000' -alpha Shape line_color.png
then i can combine these layers to create the final image:
Code: Select all
convert area_color.jpg -page +10+10 line_color.png -flatten -crop +10+10 +repage final.jpg
since i will be doing this in a loop with a lot of different colors, i need to find a way without writing all these intermediate layers out to files.
how far i got myself
i managed to reduce one step (without the -page and +repage) by creating the 'line_color.png' on the fly:
Code: Select all
convert area.jpg -background "#f3cba3" -alpha Shape -background "#558eba" -alpha remove area_color.jpg
convert \
line.jpg -negate -background '#CC0000' -alpha Shape \
area_color.jpg -reverse -composite final_nocrop.jpg
any hints from the pros?
please?