{"id":19105883,"url":"https://github.com/lobis/image-quantizer","last_synced_at":"2025-07-16T11:11:33.878Z","repository":{"id":62570540,"uuid":"457422506","full_name":"lobis/image-quantizer","owner":"lobis","description":"Python package 🐍📦 to quantize an image with a customizable palette 🎨. Output is compatible with Waveshare ePaper 📰 displays.","archived":false,"fork":false,"pushed_at":"2022-03-02T00:09:12.000Z","size":1233,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-13T19:24:59.193Z","etag":null,"topics":["actions","epaper","pillow","pypi","python","waveshare"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lobis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-09T15:45:00.000Z","updated_at":"2024-07-07T10:14:22.000Z","dependencies_parsed_at":"2022-11-03T18:25:30.224Z","dependency_job_id":null,"html_url":"https://github.com/lobis/image-quantizer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobis%2Fimage-quantizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobis%2Fimage-quantizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobis%2Fimage-quantizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lobis%2Fimage-quantizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lobis","download_url":"https://codeload.github.com/lobis/image-quantizer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251742181,"owners_count":21636398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","epaper","pillow","pypi","python","waveshare"],"created_at":"2024-11-09T04:01:27.758Z","updated_at":"2025-04-30T16:30:09.741Z","avatar_url":"https://github.com/lobis.png","language":"Python","readme":"[![Install and Test](https://github.com/lobis/image-quantizer/actions/workflows/python-test.yml/badge.svg)](https://github.com/lobis/image-quantizer/actions/workflows/python-test.yml)\n\n[![PyPI version](https://badge.fury.io/py/image-quantizer.svg)](https://badge.fury.io/py/image-quantizer)\n\n# Image Quantizer\n\nSimple Python package to convert an image into a quantized image using a customizable palette. Resulting image can be\ndisplayed by ePaper displays such as Waveshare displays.\n\n## Installation\n\nIt can be installed as a PyPi package\n\n```\npip install --user image-quantizer\n```\n\nIt can also be installed manually\n\n```\ngit clone https://github.com/lobis/image-quantizer\ncd image-quantizer\npython3 setup.py install --user\n```\n\n## Usage\n\n```\nfrom image_quantizer import quantize_image\n\nwith Image.open(\"tests/data/cliff.jpg\") as image:\n    quantized_image = quantize_image(image, palette=PALETTES[\"WAVESHARE-EPD-7COLOR\"])\n    quantized_image.save(\"cliffs-quantized.png\")\n```\n\n![input example image](https://raw.githubusercontent.com/lobis/image-quantizer/main/tests/data/cliff.jpg \"Input example image\")\n\n![quantized example image](https://raw.githubusercontent.com/lobis/image-quantizer/main/tests/data/cliff-quantized-7color.png \"Quantized example image\")\n\n### Custom palette\n\n```\nfrom image_quantizer import quantize_image, PALETTES\n\n# Existing palette names\nprint(PALETTES)\n\npalette = [\n    [0, 0, 0],  # white\n    [255, 255, 255],  # black\n    [0, 0, 255],  # blue\n    [0, 255, 0],  # green\n]\n\nwith Image.open(\"tests/data/cliff.jpg\") as image:\n    quantized_image_custom = quantize_image(image, palette=palette)\n    quantized_image_custom.show()\n```\n\n![quantized example image](https://raw.githubusercontent.com/lobis/image-quantizer/main/tests/data/cliff-quantized-custom.png \"Quantized example image\")\n\n### Split by Palette\n\nIn some cases such as highlighted [here](https://github.com/lobis/image-quantizer/issues/1), it might be useful to split\nan image into its colors. This is necessary to display the image in a waveshare RED-WHITE-BLACK display.\n\n```\nfrom image_quantizer import quantize_image, split_image_by_color\n\nwith Image.open(\"tests/data/cliff.jpg\") as image:\n    quantized_image = quantize_image(image, palette=PALETTES[\"BLACK-WHITE-RED\"])\n    split_images = split_image_by_color(image)\n    for color, image in split_images:\n        image.show()\n```\n\nOriginal image:\n![quantized example image](https://raw.githubusercontent.com/lobis/image-quantizer/main/tests/data/cliff-quantized-BWR.png \"Quantized example image BWR\")\n\nSingle palette color images:\n\n![quantized example image](https://raw.githubusercontent.com/lobis/image-quantizer/main/tests/data/cliff-quantized-BWR-BLACK.png \"Quantized example image BWR\")\n![quantized example image](https://raw.githubusercontent.com/lobis/image-quantizer/main/tests/data/cliff-quantized-BWR-RED.png \"Quantized example image BWR\")\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flobis%2Fimage-quantizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flobis%2Fimage-quantizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flobis%2Fimage-quantizer/lists"}