Skip to main content

A simple tool to create palette swap mask

Project description

icon 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

palette-mask-tuto

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

redmask-1.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

redmask-1.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file redmask-1.1.0.tar.gz.

File metadata

  • Download URL: redmask-1.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for redmask-1.1.0.tar.gz
Algorithm Hash digest
SHA256 923ad09dd9629b7c8cc5301435248fb8655883bd85e06f1c6603bb2587d1dc3f
MD5 90c8b1ba531cfd5966d512f7d5acc0a6
BLAKE2b-256 f49e3d4ae696c3b244190eaaf9358ac861cd1bdf9e9009c907138255d70daf27

See more details on using hashes here.

File details

Details for the file redmask-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: redmask-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for redmask-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d1bbc490606eff0a0cc884d3ce1b75414988b398738f68d11d05b9d518f23eca
MD5 e53b1b7a046b78d7c6e6f22fe6eaa425
BLAKE2b-256 ef30a9fe1d1ab88d467d3d80329893910174737bf8fcc0bf84a23c1f4b0da1c9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page