ImageCompositor
ImageCompositor is a SAORI by Zichqec, created for the ghost Warrior Generator. It is used as a simple image compositor, and is able to assemble a single image from multiple layers. It allows for clipping layers and masks to be used, as well. It is written in Python, and the source code is available on Warrior Generator's download page, as a .py file.
The SAORI has been known to give false positive virus warnings when downloading, because of the Pillow library it makes use of. If bundling this SAORI with a ghost, it may be necessary for the developer to submit a false positive report to Microsoft, to prevent their ghost from being falsely flagged, which makes it difficult for users to download.
Table of Contents
Usage
The SAORI will output a single image, a composite of all input images. All input images must be the same size. When the SAORI has successfully completed the composite image, it will return the string Done
(note the space included at the end of the string).
Arguments
Argument # | Description |
---|---|
Argument 1 | The path/name for the composited image to be output to. The image must be output to an existing folder, or it will throw an error. |
Argument 2+ | The file path of an input image. The developer can add as many arguments as they like, and each one will be added to the final result. Later images are stacked on top of previous images, so argument 2 is the bottom of the layers, argument 3 is the next layer up, and so on. The images must all be the same dimensions, or it will throw an error. Special delimiters may be used for special effects, including layer masks and clipping layers. |
Special Delimiters
Special delimiters are used to string two or more images together in a single argument, and apply special effects to them. For example, one image may be used to create the shape of the image, while another is clipped on top to apply a color or pattern.
Errors
If there is an error while trying to create the composite image, the SAORI will return an error message. Possible error messages are as follows; sections enclosed in [] square brackets contain arbitrary strings with additional information.
Error message | Meaning |
---|---|
Error: file not found [File path] | The SAORI cannot open one of the files specified. There may be a typo in the file path, or the developer may be asking it to output the image to a folder that does not exist. |
Error: Invalid input, multiple images must be separated by :AND:, :CLIP:, or :MASK: | The input does not match the expected formatting. |
Error: images do not match | The dimensions of the input images do not match. |
Error: [Something else] | A generic error message, the contents of which are requested to be reported to the developer. |
Examples
Note: Usage examples in this section are based on AYA/YAYA syntax, if you are using a different SHIORI you may need to change how the SAORI is called.
Consider that we have the following 3 images; shape_square.png, shape_circle.png, and color_blue.png:
Basic Composite
The following example will overlay two shapes on top of each other.
_i = FUNCTIONEX("proxy_ex.dll","ImageCompositor.exe","output.png","shape_square.png","shape_circle.png")
CLIP
The following example will overlay a color on top of a shape, respecting the transparency outside the shape.
_i = FUNCTIONEX("proxy_ex.dll","ImageCompositor.exe","output.png","shape_circle.png:CLIP:color_blue.png")
MASK
The following example will use a shape to cut away a color, creating transparency in the middle. Note that this option is currently bugged and does not work.
_i = FUNCTIONEX("proxy_ex.dll","ImageCompositor.exe","output.png","color_blue.png:MASK:shape_square.png")
Without AND
The following example will overlay two shapes, and clip a color to one of them.
_i = FUNCTIONEX("proxy_ex.dll","ImageCompositor.exe","output.png","shape_square.png","shape_circle.png:CLIP:color_blue.png")
AND
The following example will overlay two shapes, and clip a color to both of them at once.
_i = FUNCTIONEX("proxy_ex.dll","ImageCompositor.exe","output.png","shape_square.png:AND:shape_circle.png:CLIP:color_blue.png")
In all of the above examples, the return value of the SAORI will be stored in _i, which can be checked to ensure that the operation has gone through without errors.