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 the 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 still available and it’s README can be found in the README_LEGAXY.rst.

Package structure

The skytemple_tilequant package contains the code for the legacy version and the skytemple_tilequant.aikku package contains the new one.

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-0.4.1.post1.tar.gz (44.5 kB view details)

Uploaded Source

Built Distributions

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

tilequant-0.4.1.post1-cp311-cp311-win_amd64.whl (62.2 kB view details)

Uploaded CPython 3.11Windows x86-64

tilequant-0.4.1.post1-cp311-cp311-win32.whl (62.2 kB view details)

Uploaded CPython 3.11Windows x86

tilequant-0.4.1.post1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (48.2 kB view details)

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

tilequant-0.4.1.post1-cp311-cp311-macosx_11_0_universal2.whl (46.1 kB view details)

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

tilequant-0.4.1.post1-cp310-cp310-win_amd64.whl (62.2 kB view details)

Uploaded CPython 3.10Windows x86-64

tilequant-0.4.1.post1-cp310-cp310-win32.whl (62.2 kB view details)

Uploaded CPython 3.10Windows x86

tilequant-0.4.1.post1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (48.2 kB view details)

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

tilequant-0.4.1.post1-cp310-cp310-macosx_11_0_x86_64.whl (46.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ x86-64

tilequant-0.4.1.post1-cp39-cp39-win_amd64.whl (62.2 kB view details)

Uploaded CPython 3.9Windows x86-64

tilequant-0.4.1.post1-cp39-cp39-win32.whl (62.2 kB view details)

Uploaded CPython 3.9Windows x86

tilequant-0.4.1.post1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (48.2 kB view details)

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

tilequant-0.4.1.post1-cp39-cp39-macosx_11_0_x86_64.whl (46.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ x86-64

tilequant-0.4.1.post1-cp38-cp38-win_amd64.whl (62.2 kB view details)

Uploaded CPython 3.8Windows x86-64

tilequant-0.4.1.post1-cp38-cp38-win32.whl (62.2 kB view details)

Uploaded CPython 3.8Windows x86

tilequant-0.4.1.post1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (48.2 kB view details)

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

tilequant-0.4.1.post1-cp38-cp38-macosx_11_0_x86_64.whl (46.1 kB view details)

Uploaded CPython 3.8macOS 11.0+ x86-64

tilequant-0.4.1.post1-cp37-cp37m-win_amd64.whl (62.2 kB view details)

Uploaded CPython 3.7mWindows x86-64

tilequant-0.4.1.post1-cp37-cp37m-win32.whl (62.2 kB view details)

Uploaded CPython 3.7mWindows x86

tilequant-0.4.1.post1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (48.2 kB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

tilequant-0.4.1.post1-cp37-cp37m-macosx_11_0_x86_64.whl (46.1 kB view details)

Uploaded CPython 3.7mmacOS 11.0+ x86-64

tilequant-0.4.1.post1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (48.2 kB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.5+ x86-64

File details

Details for the file tilequant-0.4.1.post1.tar.gz.

File metadata

  • Download URL: tilequant-0.4.1.post1.tar.gz
  • Upload date:
  • Size: 44.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for tilequant-0.4.1.post1.tar.gz
Algorithm Hash digest
SHA256 bc0f244403a83130f0a04bfc8aba4223d83da224ab2f32483771b2c2f2fa0a5a
MD5 82ef5edbc0404dfa2d0452587d5d0819
BLAKE2b-256 4f28f8b421b262a39c12566cfb2ea16838b774ee8456b2eea2e869f6759b05ce

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 42cf7d0456c02294eeacedb6cf4d861f636a06ce50b2e397b805ddceace3c1ad
MD5 0dfb9e747e21cb3950365f9c6c1ac458
BLAKE2b-256 1de66283d6d46fb56894a283bc402bdf983588861fb7315fd7298eb612396929

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp311-cp311-win32.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp311-cp311-win32.whl
Algorithm Hash digest
SHA256 f6161ceb2472863977de626205964884ff33c688f806f0fc45e63379b61a967b
MD5 9c515c2dd69ef79a04e75e19317482c9
BLAKE2b-256 a3f469bd20aa22c4de4d869e6ab827b2fdec3eb7c4af76fd8a8632c929439f7a

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-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-0.4.1.post1-cp311-cp311-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 9acad8c9e7d4755294c084cd747477cc4a02be61c758f5619dd609a1add7c778
MD5 4dec4d42309ee3b0e1eb103df9cd48ff
BLAKE2b-256 292638a5b003884ac9eee3936c157d70c0c2a46cf75211cba824d43d925dfd35

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp311-cp311-macosx_11_0_universal2.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp311-cp311-macosx_11_0_universal2.whl
Algorithm Hash digest
SHA256 96271c5709affecb17be3e477699ff17a38b7061c6f3598012957680e5ffe021
MD5 b5ae5cf17f4285e1643aa603203b18d0
BLAKE2b-256 87ca23b92eb4ddb38d1714a31391028124929e6023a776755fe112f54b27b10b

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 ee6d0260572ce88255e0372635720d1284d2e0e51d693cd7e9a691448bcb2660
MD5 70adb662767f587f6a1b58a653d12b1a
BLAKE2b-256 d4849913b1bb26b7f06f3a0a53cb97341ed2e15d33285f191bfe3623a0856ca4

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp310-cp310-win32.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp310-cp310-win32.whl
Algorithm Hash digest
SHA256 8deda7da1d8f245ac79de2051aed93a432a2aaed8fffa7a7c2c46ed80c873d4c
MD5 dd4798b141d2ea28f21fe7eb4c7fa2ce
BLAKE2b-256 9cf1ba191b370a44166d71f5424b7df7020054080a89533fa2f7812a984afc07

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-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-0.4.1.post1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d6ee0f5e044140b9297d641ac9c1caee6d82a1ff3cd3a9de75948ed9b4f4ec97
MD5 e2cd4e1efea96455ec78c7a7c329de99
BLAKE2b-256 532a06a387c73b4d45fa1afaf6f5a044a8073f5047aaf7ffbcf544afff317b7a

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp310-cp310-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp310-cp310-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 f967a94b0a196c8c9eff77fda6b9f216bb336bb96eb2095211cd421cafe870b3
MD5 70d8e8948f04ec9d549c564cb5c20d61
BLAKE2b-256 a2251676e57d33dfbfe10dcb22827e2ea1ea74f874aee478ff650854b22ea69a

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 9f2558f42d80b554e3b461adc1a248ce40bf4d8da26cc339a2336f25523ba145
MD5 1167f301a86254382164499289918f2d
BLAKE2b-256 2ca6cf0889e1b706f2040255999b6f0a75bed49c85100bb0f447a76d295ac4e9

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp39-cp39-win32.whl.

File metadata

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

File hashes

Hashes for tilequant-0.4.1.post1-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 22a832d19f62f47e51a0f63079907a4ffa5bf03ca0f1609c5be7789381abf850
MD5 292e098956c5531d37d1f16e03f66b85
BLAKE2b-256 b23bb086dbd13c5c4a768caa020a1af2ec6674be6741e2032b2bcaeb735b8aa0

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-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-0.4.1.post1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 95c6b318caffce62a7e47e92f3e40491aa307c237b27ea6e41df0b6f2750e51c
MD5 306b283dc49f1ba23bca3daf41119b04
BLAKE2b-256 230a3f2dae5366efcc378a4f3e4a5a01a8d84fde4fbb3dd94cea2d17bc4792f9

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp39-cp39-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 c21d8ed3571a43a391cc2fc5de3d8a00df1330301960b898595c0be5e440744b
MD5 345ea425c6ce627ef95b0635fec7d641
BLAKE2b-256 ada783c616966792c93a18108e5f1207d11ef2234691a11d60b434a9c667f313

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp38-cp38-win_amd64.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 5e0b8303853a73c4a031b2a17b65738eb69ea2d844a8b65a5a07f319b0f3fbf5
MD5 c4fcbb78bac69f71dcf385a92224ff3f
BLAKE2b-256 8ab4f5847e443249c9fdc338fc58d3c4e4198c38fae1c6caf973a313e61b37cc

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp38-cp38-win32.whl.

File metadata

  • Download URL: tilequant-0.4.1.post1-cp38-cp38-win32.whl
  • Upload date:
  • Size: 62.2 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.3

File hashes

Hashes for tilequant-0.4.1.post1-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 2603edb99a28fd8041710f647533885ead11c46ff93526329e5b6703f4719463
MD5 3d53b449dab21402bc9f8499b29eb981
BLAKE2b-256 3ac2235c332afb489386e59b5247af61e63f253871f81542c8029260924cbc57

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4da62d244dcdbce8cc8a8da665443895430613da16843632d8c93c915e4cc673
MD5 eafb233cc8be06406c96f4bb942cddfe
BLAKE2b-256 aa78c6dadad7269a372064930d4bca31007174a04caa20221a06a2f7a567ab61

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp38-cp38-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp38-cp38-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 fa9a9e525d0377dffe1a4cf60040f61b0adc841edcc88fd932548f3b37a6795d
MD5 7b8cc2472ea3922970043dba6e745cc8
BLAKE2b-256 60a635633d6fc24e05cdbb7c0bffe112a620737af18aed1a07b97cbc44feb06a

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp37-cp37m-win_amd64.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 8dc8ba45797f59557fffcac12334aa7d2b0b77cc9bf212ef03ad01c2edb46b58
MD5 5c5202244926ee7590ab4d2dea10a5c2
BLAKE2b-256 5759babf9af7ca5c18aef710bf32becbf627c4d8dac5c27b8d23ebdac0a53844

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp37-cp37m-win32.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 bc866da8dc251a97d31d6753520f5b1d0386d69e20aa7610d4449b1e4979cd91
MD5 52bad98442cb7282b631226cb2cc926b
BLAKE2b-256 078129ff8bc1c95c2e271c93c1e872bbb253b9a5ef40f052dad48c2bc156ea54

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 7ee91bbd493cad1a1b4f8e578f91e518e4cfa517e531277674e03ca5a4ae879c
MD5 63b5470aae7b013876e58b004614e919
BLAKE2b-256 5a35252b5303096772d8566e607e46d4b1a1ad5c2b9dd08fd09eabe4fb4bec60

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp37-cp37m-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp37-cp37m-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 998fca73ed3975c54fde34420382f128814edc2be612222f5fd914163b212b95
MD5 3d09b86d856e1bb5e2b230604b52fd8d
BLAKE2b-256 d2616b1835bfc5209a6a196a3fea128e0049669d2f12ef5ba7ea65f7b68d044b

See more details on using hashes here.

File details

Details for the file tilequant-0.4.1.post1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for tilequant-0.4.1.post1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 358f80ca7121d571b35aad6330e199ded8ffd9d6a2ded0bba23836b4d6394f85
MD5 f3fdeef70d8f920355409c738981ac33
BLAKE2b-256 632a37858d41aa874348ffa61f405045260bd0abc058e616143bcc6c15314169

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