I have two commands that work fine:
convert Nord.png -gravity South -crop x80% -fuzz 50% -fill '#5BC236' -opaque '#8FBCBB' -background transparent -extent 800x800 out.png
convert Nord.png out.png -gravity Center -composite -background '#2E3440' -gravity Center -extent 3840x2160 background.png
What they do is that they take a PNG file like this:
And convert it to an image like this:
But in the process, a file like this is created:
I'm wondering if it's possible to combine these two commands, so that a) there's only one call to the convert
command, and b) only one file is created as the output.
I tried this command,
convert Nord.png -gravity South -crop x80% -fuzz 50% -fill '#5BC236' -opaque '#8FBCBB' -background transparent -extent 800x800 out.png -gravity Center -composite -background '#2E3440' -gravity Center -extent 3840x2160 background.png
But the output is different:
How can I combine these two commands into one?
You should be able to do some "aside-processing" in parentheses to clone the Nord.png
image and make the crop and colour changes then when you exit the parentheses you will still have the Nord.png
you started off with and the cloned, recoloured, resized image in the image stack which is how your second command starts anyway:
convert Nord.png \
\( +clone -gravity South -crop x80% -fuzz 50% -fill '#5BC236' -opaque '#8FBCBB' -background transparent -extent 800x800 \) \
-gravity Center -composite -background '#2E3440' -extent 3840x2160 background.png
The -gravity Center
is a setting that gets remembered till you change it so there is no need to repeat it.