redmask
A simple tool to create palette swap mask
How palette swap mask works
A palette swap mask is an image used to map a palette using a gradient scale.
The tool will generate a red gradient image because green and blue values are useless for the mask.
Full explanation about palette mask: https://www.youtube.com/watch?v=u4Iz5AJa31Q
Using the generated mask
The mask can be used in a palette swap shader.
Example shader in Godot Engine 2.1.x:
// fragment
uniform texture palette;
uniform float colors;
uniform float color_step;
if (COLOR.a != 0){
COLOR = tex(palette, vec2((COLOR.r*255.0)/(colors-0.001) / color_step, 0));
}
// '0.001' part is a workaround to fix float precision issues.
Basic usage
# redmask = python redmask.py
redmask <input> <palette>
# generate a mask using default color step (1)
redmask <input> <palette> -s 10
# generate a mask using 10 as color step
redmask <generated-mask> <palette> -a
# apply a palette (paint the mask) using default color step (1)
You can test using images in the tests directory.
Also, you can view usage info using the -h/--help command.
Example art made by Yomieda.
Release files for redmask 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| redmask-1.1.0.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| redmask-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.8 kB
Release files / redmask-1.1.0.tar.gz
| Download URL | redmask-1.1.0.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
923ad09dd9629b7c8cc5301435248fb8655883bd85e06f1c6603bb2587d1dc3f
|
|
BLAKE2b-256 checksum How to use checksums |
f49e3d4ae696c3b244190eaaf9358ac861cd1bdf9e9009c907138255d70daf27
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.7
|
Release files / redmask-1.1.0-py3-none-any.whl
| Download URL | redmask-1.1.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1bbc490606eff0a0cc884d3ce1b75414988b398738f68d11d05b9d518f23eca
|
|
BLAKE2b-256 checksum How to use checksums |
ef30a9fe1d1ab88d467d3d80329893910174737bf8fcc0bf84a23c1f4b0da1c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.7.7
|