Skip to main content

Add your description here

Project description

GIF Color Changer

Small script for replacing colors in a GIF. It takes one or more color mappings, applies them to every frame, and writes a new GIF.

Setup

uv sync

Usage

uv run python main.py input.gif output.gif \
  --map "#FFFFFF=#FF0000" \
  --map "#000000=#00FF00"

Or use the installed command:

uv run gifcc input.gif output.gif \
  --map "#FFFFFF=#FF0000" \
  --map "#000000=#00FF00"

Each --map is:

source_color=replacement_color

So this:

--map "#FFFFFF=#FF0000"

means:

replace white with red

You can pass as many mappings as you need. They run in order, and a pixel is only changed once.

Tolerance

GIF colors are often not exactly what they look like, especially after palette conversion or compression. Use --tolerance to match colors that are close to the source color.

uv run python main.py input.gif output.gif \
  --map "#FFFFFF=#FF0000" \
  --tolerance 20

The default tolerance is 10.

Output

The script prints how many pixels were changed for each mapping:

(255, 255, 255) -> (255, 0, 0): changed 1234 pixel(s)

If a mapping says it changed 0 pixels, the source color probably does not exist in the GIF at that tolerance.

Install as a uv Tool

From this repo:

uv tool install .

Then run it from anywhere:

gifcc input.gif output.gif --map "#FFFFFF=#FF0000"

To remove it:

uv tool uninstall gif-color-changer

Build

uv build

That writes the package artifacts to dist/.

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

gif_color_changer-0.1.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gif_color_changer-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file gif_color_changer-0.1.0.tar.gz.

File metadata

  • Download URL: gif_color_changer-0.1.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gif_color_changer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b1b3a305eb080e869d8e02190a08dd72e7ae268059c2bfdee032b4d25b036fee
MD5 e7e1a88d67ff339caf2ae8574723e0e6
BLAKE2b-256 671a2e04b2b17184c5e600c24f38ecbb72f4ef356fcf89d319aebccc157a0f2e

See more details on using hashes here.

File details

Details for the file gif_color_changer-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gif_color_changer-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for gif_color_changer-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87d81950874a06cffb655bf6b4d8830f856bb0d0d42ad2f71ab01c1bd6ef376b
MD5 92a747d50bbab561b1c10fb64cac13a8
BLAKE2b-256 168133695cdfcf230465ae7c1e8f6d5417d8b1e80f7bcbd3cb2a8c412c529f1b

See more details on using hashes here.

Supported by

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