A script to help fix 8-bit sprites so that they are more upscale-friendly.
Normally when upscaling these sprites, the transparency bit will be taken into consideration by the upscaling model. This causes some fringe artifacts around the sprite.
8-bit PNG | Upscale Result | Comment |
---|---|---|
The green transparency bit produces a green tinge around the sprite. |
This script will convert the sprite into 32-bit sprites so that transparency is handled by the alpha-channel, and pads around the sprite with pixels based on the sprite itself.
32-bit PNG | Upscale Result | Comment |
---|---|---|
Tinge is removed, and outline colours more consistent with original sprite. |
- Python 3 (Recommend to use Anaconda)
- Python packages:
pip install numpy opencv-python
- Put in the sprites into the
input
folder. OpenCV is only able to readpng
andjpg
files, so if you havegif
files, convert them topng
first. - Run
python fixsprite.py
- Output appears in
output
folder
- Check if files are in 8-bit PNG with transparency first, otherwise skip.
- Add parameter handling so that user can define input and output folders themselves.
- Take note that not all sprites need to be fixed, and some models may have better output without the padded pixels. Use only if fringe artifacts appear on the upscaled sprite.
- If you have any questions, we have a discord server where you can ask them and a Wiki with more information.