Difference between revisions of "Palette Cleanup"
(First Draft) |
m (→Background - Is this really needed?) |
||
Line 4: | Line 4: | ||
Unit sprites are supposed to be pixel art, but sometimes this breaks down. Maybe someone accidentally edited an image with an anti-aliasing tool (e.g. cut-paste lasso, paintbrush) or maybe the original contribution just had too many similar colors. Starting in 1.17, an effort was made to enforce a set palette: https://github.com/wesnoth/wesnoth/issues/6417 | Unit sprites are supposed to be pixel art, but sometimes this breaks down. Maybe someone accidentally edited an image with an anti-aliasing tool (e.g. cut-paste lasso, paintbrush) or maybe the original contribution just had too many similar colors. Starting in 1.17, an effort was made to enforce a set palette: https://github.com/wesnoth/wesnoth/issues/6417 | ||
− | + | ==Background== | |
====Why do sprites need to be pixel art?==== | ====Why do sprites need to be pixel art?==== | ||
The game works just fine with non-pixel art images, but there are few reasons for the pixel art sprite convention: | The game works just fine with non-pixel art images, but there are few reasons for the pixel art sprite convention: |
Revision as of 20:54, 23 August 2025
This is WIP, should not be linked to yet.
Contents
Purpose
Unit sprites are supposed to be pixel art, but sometimes this breaks down. Maybe someone accidentally edited an image with an anti-aliasing tool (e.g. cut-paste lasso, paintbrush) or maybe the original contribution just had too many similar colors. Starting in 1.17, an effort was made to enforce a set palette: https://github.com/wesnoth/wesnoth/issues/6417
Background
Why do sprites need to be pixel art?
The game works just fine with non-pixel art images, but there are few reasons for the pixel art sprite convention:
- Simplifies color swapping - having a set palette makes it simpler to map the original colors to new colors. The most obvious example of this is the team coloring magenta/pink conversion to red for player 1.
- Distinction from terrain/scenery - The terrain and scenery images are not pixel art. With the current conventions, the sprites or "game pieces" should have a clear distinction from the background or "game board"
- Stylistic decision - pixel art is an art form, not simply a limitation, even if it may have had its origins in graphics limitations.
Enforcing a palette means restricting colors... Don't cramp my artistic expression!
It might sound restrictive, but no one said the palette needed to be 8-bit. If you need to add a color to the palette, that is fine, just do it deliberately.
Example
Consider these two images:
The one on the left has 72 colors, the one on the right has 41. Notice the difference? If the palette was chosen correctly, the changes should not noticeably alter the image. Even 41 colors is probably more than is really needed. A bash script to produce the output was:
#!/bin/bash
mkdir output
mkdir reports
for f in *.png
do
magick $f -dither None -remap HumanLoyalist_ColorMap.png -strip output/$f
# comment these out if you don't need to manually check the results
convert output/$f -define histogram:unique-colors=true -format %c -write histogram:info:reports/info-histo_output_$f.txt
convert $f -define histogram:unique-colors=true -format %c -write histogram:info:reports/info-histo_input_$f.txt
done
rm output/*ColorMap.png
echo Finished!
The ColorMap image is included in mainline unit image directories, but you could use your own. You'll see in the output reports that there are still colors with only 1-3 pixels.