Hi @Symbiosis,
Could you say more about what you mean by color swaps? In the image below, do either the top or the bottom diagram show what you’re trying to do?
On the Aseprite end, I reckon you’d need a script. The scripting API’s app.fs module helps with file system management, for example listing the files in a directory. Palettes can be loaded with a file path, as can Images. Images have a saveAs method.
The task might be easier if the images are in Indexed color mode than if they are in RGB color mode. For RGB color mode, a table
in Lua is quite flexible, though, and Color
s can be converted to and from 32-bit integers. So you could create a dictionary wherein each entry is defined as key = original color, value = destination color. Handy if you had to loop through every pixel to make the swap. Just so long as the image doesn’t contain any colors not in the source palette, such as ones introduced through blending.
Alternatively, you could think of the corrupted version in terms of new layer that sits on top of the original image and augments the pixels underneath, in the simplest case with a built-in layer blend mode.
Depending on which of you is the more experienced coder / is the video game’s main coder, they instead could research how to color swap or blend in the game engine with a shader. Ideally, you’d be able to give them the palettes and images as separate resource sets. This may return you to a similar problem if, say, the images need to be changed in bulk to cooperate with the shader.
Cheers,
Jeremy
Similar topics: