Metadata-Version: 2.1
Name: redmask
Version: 1.1.0
Summary: A simple tool to create palette swap mask
Home-page: https://github.com/williamd1k0/redmask
Author: William Tumeo
Author-email: pypi@tumeo.space
License: UNKNOWN
Download-URL: https://github.com/williamd1k0/redmask/archive/v1.1.0.tar.gz
Keywords: palette,gimp,krita,shaders
Platform: UNKNOWN
Classifier: Topic :: Utilities
Classifier: Topic :: Multimedia :: Graphics
Classifier: Environment :: Console
Classifier: Environment :: Win32 (MS Windows)
Classifier: Environment :: MacOS X
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft
Classifier: Operating System :: Microsoft :: Windows :: Windows 7
Classifier: Operating System :: Microsoft :: Windows :: Windows XP
Classifier: Operating System :: Microsoft :: Windows :: Windows Vista
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Description-Content-Type: text/markdown
Requires-Dist: pillow (>=5.0.0)

# ![icon](https://raw.githubusercontent.com/williamd1k0/redmask/master/icon.png) 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](https://www.youtube.com/watch?v=u4Iz5AJa31Q)

![palette-mask-tuto](https://raw.githubusercontent.com/williamd1k0/redmask/master/tests/palette-mask.png)

## Using the generated mask

The mask can be used in a palette swap shader.

Example shader in Godot Engine 2.1.x:

```glsl
// 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

```bash
# 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](https://twitter.com/yomieda).


