qTipTip / Pylette

A Python library for extracting color palettes from supplied images.
https://qtiptip.github.io/Pylette/
MIT License
108 stars 11 forks source link

Consolidate the different image input types under the `image` argument #34

Closed qTipTip closed 4 months ago

qTipTip commented 4 months ago

Motivation

You can now pass a filename, a URL, bytes, an array, etc directly into the image-argument to the extract_color function. You no longer have to remember to use image_url, image_bytes, etc.

Example:

These all work:

palette = extract_colors("https://your-image-url.com/test-image.png", ...) # From an URL
palette = extract_colors(open("/image/as/bytes", "rb").read(), ...).  # Image as bytes
palette = extract_colors(pathlib.Path("/path/to/image.png"), ...)  # any PathLike