rickysullivan wrote:I get confused with the order of commands in ImageMagick. I thought -composite had to be the final command before output.
It is just an operator that takes 2 (or 3 with a (what should change) mask) and composes them according to the current -compose, -gravity, and -geometry settings.
Another simular operator is -flatten (or -mosaic) which takes a list of images with virtual canvas offsets (-page), a initial starting canvas (-background) and the composition method (-compose) to merge the list into one image (multiple image layer flatten).
When it comes to maintaining the transparency through out the command, I thought setting the -background transparent -virtual-pixel background before any commands applied to everything that was performed in the convert command
Both are just settings, and as with any setting, only effects operators that follow the setting (not before).
Background just sets a specific color used by some operators (like -flatten) -virtual-pixel, just defines how to handle references to pixels that fall outside or surrounding the actual image given. Neither actually gives an image a alpha (transparency) channel, if it does not have one (JPEG doesn't).
Some operators do automatically give a resulting image alpha, but only if that operator is directly associated with an alpha channel. +distort does NOT, and neither does -composite.
"-alpha set" is an operator that modifies the image to ensure it has an alpha channel, but without actually changing the actual 'look' of an image. That is is an image does not have an alpha channel (created or enabled) it will create, and clear it to be fully-opaque. If the image already has alpha and some transparency, ENABLED, it leaves it alone.
Do not confuse this with -alpha on, which will not clear a existing but disabled alpha, to opacity. IT just re-enables it without any clearing, which could modify the 'look' of an image, that may have been previously using an alpha channel.
Perhaps I should be using PNG for both files.
Not necessary, as long as the 'destination' has alpha, the result of the composition will have alpha. Destination controls most aspects of the results of a composite image.
I'm using scale so I can target a specific size and not by percentage, I thought SRT was only by percentage. I've also changed from -scale to -adaptive-resize as this seems to look a bit better.
That is true. SRT can only do it by size. It is just a scaling factor. However SRT is really an AFFINE transform, and you can specify things in pixels with that transform, though you can not easily specify rotations with it.
WARNING: scale generates 'block' artefacts (giant pixels). It is essentially a 'nearest neighbour' interpolation. Adaptive resize generates a 'mesh' interpolative gradient.
http://www.imagemagick.org/Usage/misc/#mesh
Resize will generate a smoother image, that is generally preferred.
However if you can incorperate the scale into the SRT (calculate the scaling factor if you need to) then the resulting image will be directly generated using the distorts own scaling filters, as part of the distortion.
Remember scale, adaptive-resize and resize, are all themselves a type of distortion operation (specially designed limited form of distort), and distorts of distort should be avoided if possible, to generate the best quality result.
I do not mean to say you are doing wrong. What you are doing is perfectly acceptable, and if it is easier and you are okay with the results, fine. Just letting you know there are alternatives.