Skip to main content

palettify - Apply color palettes to images within seconds

Requirements

You will need either pillow or pillow-simd. The latter might give a performance boost, however it does not support as many architectures.

Installation

The installation itself is quite easy, simply run:

pip install palettify
Didn't work?
  • pip is not in PATH

    python -m pip install palettify
    
  • Check if the path of your python executable matches the path of the interpreter you run your code with
    In UNIX-like systems:

    which python
    

Usage

You can use either the command-line or the python API to palettify an image.

Through the command-line: Invoke palettify using palettify or python -m palettify.

paths [paths ...] (required)

You can input multiple images, each one pointing to an existing file. A list of supported image formats can be found here.

-p/--palette (required)

The color palette to use. If an integer n, palettify will try to find the n most dominant colors in the original image and build the palette using those colors. Otherwise, a path to a JSON file should be specified, containing a list of RGB channels.

[
    [255, 255, 255],
    [0, 0, 0],
    [0, 255, 0],
    [255, 255, 0]
]

-o/--output (optional)

If more than one input path is given, the output path has to be an existing directory. If only one input path is given, the output path can be either a directory or the path to a file. If no output path is given, palettify will create path duplicates of the input paths and add a -palettified suffix.

-a/--autoscale (optional)

If autoscale is enabled, palettify tries to find the desktop resolution and resizes the image accordingly, while keeping the original ratio. A display server is required Defaults to False.

-w/--width (optional)

The width of the palettified image. If -h/--height is not given, palettify will calculate the height to keep the original ratio.

-H/--height (optional)

The height of the palettified image. If -w/--width is not given, palettify will calculate the width to keep the original ratio. If neither width or height are given, palettify will use the resolution of the original image.

-t/--threads (optional)

The number of threads to start for a single image. Defaults to 10.

-v/--verbose (optional)

Whether to explain what is being done. Defaults to False.

Invoking palettify through python

from palettify import palettify_image

palettify_image(...)

You can pass in the same arguments as in the command-line. However, optional arguments are keyword-only.

Release files for palettify 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for palettify 0.0.6
File Size Uploaded
palettify-0.0.6.tar.gz 39.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for palettify 0.0.6
File Interpreter ABI Platform
palettify-0.0.6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.5+ x86-64 Details

Total release size: 153.2 kB

Release files / palettify-0.0.6.tar.gz

Download URL palettify-0.0.6.tar.gz
Size 39.2 kB
Tags Source
SHA-256 checksum
How to use checksums
68c96deb8e10bdc4fcead18682970244d9a5e6ecb901ded8db3681fc04cc7adc
BLAKE2b-256 checksum
How to use checksums
edb57cafd1a73b644f31a4a42c75f28c9c7d197a5eff9c12927a2edbe7e0be52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / palettify-0.0.6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl

Download URL palettify-0.0.6-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl
Size 113.9 kB
Tags CPython 3.9 Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
78764a3f9544cf1b7bc48d13186051ee5b571a4cc180c9acbb452f44b2c57a3d
BLAKE2b-256 checksum
How to use checksums
fdb33a7ac9b1f2fa3b195194473824733560a0c4cb42a9f19ae03abee712df4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page