Skip to main content

Tool for quantizing image colors using tile-based palette restrictions

Project description

Build Status Version Downloads License (MIT) Supported Python versions

Tilequant is a utility to reduce the colors in an image (quantizing). The current version is based on Tilequant by Aikku93 (the same name is coincidental)).

It does so by limiting each tile (by default an area of 8x8 pixels) of the image to a subset of colors (a palette). The whole image has one big palette that consists of those smaller palettes.

This tool is a standalone part of SkyTemple, the ROM editor for Pokémon Mystery Dungeon Explorers of Sky. By default it produces images that can be used by SkyTemple. However the images are probably also useful for use with other games that have similar restrictions for backgrounds.

Make sure the input image is a RGB image without an alpha channel. The image library used has some problems with converting other image types to RGB in some cases.

The output is an image with a palettes as shown in the example.

https://github.com/SkyTemple/tilequant/raw/master/examples/export_example2.png

(This example is based on an old legacy version).

This tool is not affiliated with Nintendo, Spike Chunsoft or any of the parties involved in creating Pokémon Mystery Dungeon Explorers of Sky. This is a fan-project.

Installation

Python 3 is required.

Via pip3:

pip3 install -U tilequant

Usage

Usage: tilequant [OPTIONS] INPUT_IMAGE OUTPUT_IMAGE

  Converts any image into a indexed image containing a number of smaller
  sub-palettes (--num-palettes), each with a fixed color length (--colors-
  per-palette). The conversion will assign each tile in the image one of
  these sub-palettes to use (single-palette-per-tile constraint).

  INPUT_IMAGE is the path of the image to convert and OUTPUT_IMAGE is where
  to save the converted image. All image types supported by PIL (the Python
  image library) can be used. :return:

Options:
  -n, --num-palettes INTEGER      [Default: 16] Number of palettes in the
                                  output.
  -c, --colors-per-palette INTEGER
                                  [Default: 16] Number of colors per palette.
                                  If transparency is enabled, the first color
                                  in each palette is reserved for it.
  -t, --transparent-color TEXT    A single color value (hex style, eg. 12ab56)
                                  that should be treated as transparent, when
                                  doingthe conversion with transparency
                                  enabled.
  -v, --loglevel [DEBUG|INFO|WARNING|ERROR|FATAL|CRITICAL]
                                  [Default: INFO] Log level.
  --help                          Show this message and exit.

Examples

For the new version no examples exist yet. However to get a general idea, you can view the examples of the old version in “examples”.

Transparency

The actual amount of colors per palette is one lower than specified and a “transparency color” is added at index 0 of all palettes. If transparent-color is specified, the image is scanned for pixels with this color first and in the end, those pixels will be assigned their local “transparent color” index.

Legacy version

Originally (before integrating the new and much better newer version based on Tilequant by Aikku93) there was a pretty bad pure-Python based version of this tool. It is no longer available in current versions of this lib, to access it see versions prior to 1.x.

The only thing left over from the legacy implementation is Tilequant.simple_convert (only accessible via API) which allows trying to convert images without running any sort of quantization on them, failing if not possible.

Special Thanks

  • Aikku93

  • Nerketur

  • AntyMew

  • psy_commando

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

tilequant-1.1.0.tar.gz (90.3 kB view details)

Uploaded Source

Built Distributions

tilequant-1.1.0-cp312-cp312-win_amd64.whl (50.1 kB view details)

Uploaded CPython 3.12 Windows x86-64

tilequant-1.1.0-cp312-cp312-win32.whl (46.8 kB view details)

Uploaded CPython 3.12 Windows x86

tilequant-1.1.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (75.2 kB view details)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

tilequant-1.1.0-cp312-cp312-macosx_10_9_universal2.whl (53.7 kB view details)

Uploaded CPython 3.12 macOS 10.9+ universal2 (ARM64, x86-64)

tilequant-1.1.0-cp311-cp311-win_amd64.whl (50.1 kB view details)

Uploaded CPython 3.11 Windows x86-64

tilequant-1.1.0-cp311-cp311-win32.whl (46.9 kB view details)

Uploaded CPython 3.11 Windows x86

tilequant-1.1.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (75.2 kB view details)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

tilequant-1.1.0-cp311-cp311-macosx_10_9_universal2.whl (53.7 kB view details)

Uploaded CPython 3.11 macOS 10.9+ universal2 (ARM64, x86-64)

tilequant-1.1.0-cp310-cp310-win_amd64.whl (50.1 kB view details)

Uploaded CPython 3.10 Windows x86-64

tilequant-1.1.0-cp310-cp310-win32.whl (46.8 kB view details)

Uploaded CPython 3.10 Windows x86

tilequant-1.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (75.2 kB view details)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

tilequant-1.1.0-cp310-cp310-macosx_11_0_x86_64.whl (44.3 kB view details)

Uploaded CPython 3.10 macOS 11.0+ x86-64

tilequant-1.1.0-cp39-cp39-win_amd64.whl (50.1 kB view details)

Uploaded CPython 3.9 Windows x86-64

tilequant-1.1.0-cp39-cp39-win32.whl (46.9 kB view details)

Uploaded CPython 3.9 Windows x86

tilequant-1.1.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (75.2 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64 manylinux: glibc 2.5+ x86-64

tilequant-1.1.0-cp39-cp39-macosx_11_0_x86_64.whl (44.3 kB view details)

Uploaded CPython 3.9 macOS 11.0+ x86-64

File details

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

File metadata

  • Download URL: tilequant-1.1.0.tar.gz
  • Upload date:
  • Size: 90.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for tilequant-1.1.0.tar.gz
Algorithm Hash digest
SHA256 b96d60de7953e98fb56de89fa3f30e946c6c18bee89ff8dc0113b149d7724879
MD5 5001d250e67b208e812ed8451ca58d56
BLAKE2b-256 73c84bba1ead2022099f64e6f295234c91e7b3584e3ba0a25be62b406f75ba53

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for tilequant-1.1.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 2491c1d3615dd7ca24339b8bb8ac3d13d7b5f0bd65a9069ecace4b05f939ddc0
MD5 2ef2eaf9a4f49929b581fc609b7868d9
BLAKE2b-256 b3903e7c873d0d01fa5a9c0874a8c8c2400748e964d02d1d495cb8689cfa54ca

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp312-cp312-win32.whl.

File metadata

  • Download URL: tilequant-1.1.0-cp312-cp312-win32.whl
  • Upload date:
  • Size: 46.8 kB
  • Tags: CPython 3.12, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for tilequant-1.1.0-cp312-cp312-win32.whl
Algorithm Hash digest
SHA256 b6ddc75c2b7dfb7f7b2631a7c81542728d40c77d9a50180e5ff1dcfa5d18e87e
MD5 d181b432d39e50d0cf2af4ca70b4b860
BLAKE2b-256 bfb9dc1398c716bfeb2b7cfcdd9c7e874e0ee5eb77c5e60be1da10343ebcef93

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-1.1.0-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2c8fd1252b1f3ae10dd9ffec29f1989cc96af00f94937fe53f309684abfcc808
MD5 e57eeb6ae72c397026134443586c54dd
BLAKE2b-256 7d5d4f76296c370f53c9c8c51ad832957485fc3937cd49f15bc24607dd3910f9

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp312-cp312-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tilequant-1.1.0-cp312-cp312-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 a8f501342a97b8b31b85f975b39a23516c2483d2b580348bfa37d57253179ab6
MD5 d3970f8edaa44720b2cd421f7655d2a6
BLAKE2b-256 36b4f6ed86520f93e7187de7c4a853517597ce25f387f0b532eb25b2d37db437

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for tilequant-1.1.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2f0e784e82acc04e12b81831a93e847beab38d6fb89d4e0d41801cd7a36e3656
MD5 6edd6c63408cb8bbdb387453df8c6cdc
BLAKE2b-256 64929ac7cba26eb0cf8f76e01eb3f47aea384752b8dedd44145aa63a8cd5f710

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp311-cp311-win32.whl.

File metadata

  • Download URL: tilequant-1.1.0-cp311-cp311-win32.whl
  • Upload date:
  • Size: 46.9 kB
  • Tags: CPython 3.11, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for tilequant-1.1.0-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 0450edc07ba1529ed3ea568f7d503c4b769bf3efa3dde7fc657e496e7d17f042
MD5 6769dcd5241bba3e1307b11f8f9c1650
BLAKE2b-256 297c48e11023f46dcdf6459f47b739f05f16a7114be00d342d8949d847878543

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-1.1.0-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8ec49fa172ebd579a2988ac2467a8e9f4e82d4d6e55b55eb6606c0b7f021f7d4
MD5 93bfa817a2d7bd99f10734b66ca8f58b
BLAKE2b-256 cdf2560f83ae75ef66ed715b4ddb4b65ad8588ef2458c684d29253a4cdf4fe1f

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp311-cp311-macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for tilequant-1.1.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 96f3e00991e2e1452424fab06461f8089dc3562ea80ee3b6178c7fc63e13918b
MD5 09eede540f545a0c279c6e61e320a8e0
BLAKE2b-256 d06d7d57c0f0e8e939897d451c658723008c55e807c1973438aae591947ba762

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for tilequant-1.1.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 5b4fd87ba040cb86b7bda9cd73388333b4521292771c45b198ea58a2818f412a
MD5 c5026a4180cb84e0e36023828fa0e1a5
BLAKE2b-256 433465d7081c60b257e3bc51e702257c421ad956e246f18876502b78cbf547d7

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp310-cp310-win32.whl.

File metadata

  • Download URL: tilequant-1.1.0-cp310-cp310-win32.whl
  • Upload date:
  • Size: 46.8 kB
  • Tags: CPython 3.10, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for tilequant-1.1.0-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 55f29d073d03232a34fd4fd98fecc230aaa2a6e02bdd4cef4a79781005af8e3d
MD5 83d6cf7b6301101ecede5e97e41add97
BLAKE2b-256 97bf7165382ecc9319bc8a75d47c039e64c6818102a9984a18008095e5bf50c8

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-1.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f95a4bb3dcf084c5d9b19c4a4b5f0f0092aeefae83e29ae9441025bd291db666
MD5 79b9c834477ea865090f2aef3ff9c48d
BLAKE2b-256 c5e43a337ce58296ab5aa5a394768ee168c494bfd788e9ecddd771b2e35afe47

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-1.1.0-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9d6b693bd7b909eeaf92314b355a31f513a7b5e0a1710140dca5412e661fbf10
MD5 45539f1868f694e993a963d23a280789
BLAKE2b-256 a3b39f38c1911360f3e26fba2b1d0f41ab9c2c006a79e57cd2eaa21e124815ed

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: tilequant-1.1.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 50.1 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for tilequant-1.1.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 83d6811cf65c2cae25b1eb6aa3990ff8f927290731fab2e7266c5455d9bdd82d
MD5 0506d3f15855d33b16d794d9c666c2c9
BLAKE2b-256 67b8f0b33988a93af12d42a92fa4aff2f8ba37fa55ce938f972bcc4ea9351e7d

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp39-cp39-win32.whl.

File metadata

  • Download URL: tilequant-1.1.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 46.9 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for tilequant-1.1.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 2a5eed878f994e38b6cb346ffce3f96ee0fa5068a2ca09cfbdfd38ad107e31e6
MD5 6da8cd14484edfe9ae3f42cc234e0f27
BLAKE2b-256 3ff095bd33a48f1ac76988deb91ea7937240cf572c0f4f29a497b599e65229e8

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-1.1.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cdf46b9b4701ff5e186fb8953dea4e68ff99ff971ff7ae69b0a8e7f572e1414a
MD5 9f465786cc377f3c4b5a598fac940f56
BLAKE2b-256 bc558618eb644b71dce103425ef7ce0510e3695c914643e5d95178cfebc3e87e

See more details on using hashes here.

File details

Details for the file tilequant-1.1.0-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-1.1.0-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 4fce6f0ac35040de1f1d9d6da106276bcc48639d2be8eb8908d39a3399de0708
MD5 3109a95764f613b6c0900a9fa1409a5b
BLAKE2b-256 2844c44b9004cbd91a6d00df58a9164fcac012be2c0660b7d80ab72f54042374

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