Crates.io | rgba8888-to-rgb332 |
lib.rs | rgba8888-to-rgb332 |
version | 0.1.0 |
source | src |
created_at | 2023-08-19 03:06:38.85825 |
updated_at | 2023-08-19 03:06:38.85825 |
description | A cli tool that will process all files found in an input folder, transforming them from a file format containing full 16 million color PNG files to 8-bit raw data files. |
homepage | |
repository | https://github.com/dennis-lawter/rgba8888-to-rgb332 |
max_upload_size | |
id | 948467 |
size | 35,075 |
rgba8888-to-rgb332
is a cli tool that will process all files found in an input folder, transforming them from a file format containing full 16 million color PNG files to 8-bit raw data files. This is accomplished using a restrictive palette. Transparent pixels can be replaced with a specified color.
The RGB332 raw file outputs are useful for developing software using embedded graphics, where an 8-bit color palette can reduce memory usage drastically and adhere to certain display requirements.
Color masking is an optional feature provided, granting a way to choose a pixel color to skip when blitting pixels to a buffer. For example, if the color 0b111_000_11 (hex #ff00ff or #ff00ffff with transparency channel) is chosen, it is simple during development to add that pixel color to a branch statement, and omit drawing it to the screen. This provides the user to implement their own transparency.
MASK_COLOR
rgba8888-to-rgb332 -i <your_sprite_folder> -o <your_output_folder>
-m <mask_color>
argument0b00000000
or 0b000_000_00
for visual separation of the r_g_b channelsThe palette used to map RGBA8888 to RGB332 follows strict rules. For simplicity, it will be described using 8 character HEX color code rules.
#00______ no red
#24______
#49______
#6d______
#92______
#b6______
#db______
#ff______ full red
#__00____ no green
#__24____
#__49____
#__6d____
#__92____
#__b6____
#__db____
#__ff____ full green
#____00__ no blue
#____55__
#____aa__
#____ff__ full blue
#______00 a fully transparent pixel
#______ff a fully opaque pixel
Note: When the alpha channel is 00, the first 3 bytes of the pixel are ignored.