Grafx wrote:
Another thing I am confused about is the arguments "image" and "drawable". Which is being save to the file? The "drawable", I assume is a layer. What else could a "drawable" be? Are both to be specified or only one?
A drawable can be one of a layer, a layermask, or a channel. When you run a 'file-*-save' non-interactively, whether the 'drawable' parameter is respected depends upon the plug-in being used.
'file-gif-save' always ignores the drawable parameter and saves all layers (ignoring any layermasks). If the image is not in Indexed mode than an error results. Alpha channels are thresholded to either opaque or transparent.
'file-png-save' will only save the specified drawable. The drawable may or may not have an alpha channel, and the image can be in RGB, GRAYSCALE, or INDEXED mode. Indexed mode PNG saves (unfortunately) treat the alpha channel identically to GIF saves (rather than the more capable PNG standard for Indexed alpha channels).
'file-jpg-save' will only save the specified drawable, and if the layer has an alpha channel then it is ignored. If the image is in Indexed mode then an error results.
If I recall correctly, prior to version 2.8 the above behavior was in some cases different than described above (for example, saving multi-layer images to PNG or JPG resulted in an error).
Because of the above inconsistencies, when exporting to non-XCF formats in a script it is generally a good idea to create a temporary image which you can modify so as to satisfy any and all limitations of the targeted file format.