{"id":15681322,"url":"https://github.com/sgreben/image-palette-tools","last_synced_at":"2025-09-01T04:35:08.784Z","repository":{"id":41445837,"uuid":"134350246","full_name":"sgreben/image-palette-tools","owner":"sgreben","description":"extract palettes from images / cluster images by their palettes","archived":false,"fork":false,"pushed_at":"2018-05-23T22:18:05.000Z","size":274,"stargazers_count":12,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-05T04:43:18.848Z","etag":null,"topics":["cli","image","image-clustering","json","palette-generation"],"latest_commit_sha":null,"homepage":"","language":"Go","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/sgreben.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":"2018-05-22T02:35:39.000Z","updated_at":"2024-09-07T21:40:16.000Z","dependencies_parsed_at":"2022-08-01T00:38:01.145Z","dependency_job_id":null,"html_url":"https://github.com/sgreben/image-palette-tools","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sgreben/image-palette-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgreben%2Fimage-palette-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgreben%2Fimage-palette-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgreben%2Fimage-palette-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgreben%2Fimage-palette-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sgreben","download_url":"https://codeload.github.com/sgreben/image-palette-tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgreben%2Fimage-palette-tools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273073671,"owners_count":25040793,"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","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cli","image","image-clustering","json","palette-generation"],"created_at":"2024-10-03T16:52:47.480Z","updated_at":"2025-09-01T04:35:08.750Z","avatar_url":"https://github.com/sgreben.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# image-palette-tools (WIP)\n\n`image-palette-tools` is a set of related image tools:\n\n- `extract-palette` - generates a color palette from an image\n- `cluster-by-palette` - clusters a set of images by their color palettes\n\nThe tools support PNG, JPEG, and GIF images.\n\n\u003c!-- TOC --\u003e\n\n- [Get it](#get-it)\n- [Use it](#use-it)\n    - [`extract-palette`](#extract-palette)\n        - [Examples](#examples)\n    - [`cluster-by-palette`](#cluster-by-palette)\n        - [Examples](#examples-1)\n- [Comments](#comments)\n\n\u003c!-- /TOC --\u003e\n\n| Image                  |                         Palette (k=5)  |\n|------------------------|----------------------------------------|\n| ![img1](docs/img1.jpg) | ![img1-palette](docs/img1-palette.png) |\n| ![img2](docs/img2.jpg) | ![img2-palette](docs/img2-palette.png) |\n| ![img3](docs/img3.jpg) | ![img3-palette](docs/img3-palette.png) |\n\n\n## Get it\n\nUsing go get:\n\n```sh\ngo get -u github.com/sgreben/image-palette-tools/cmd/extract-palette\ngo get -u github.com/sgreben/image-palette-tools/cmd/cluster-by-palette\n```\n\nOr [download the binaries](https://github.com/sgreben/image-palette-tools/releases/latest) from the releases page.\n\n```sh\n# Linux\ncurl -L https://github.com/sgreben/image-palette-tools/releases/download/0.0.1/extract-palette_0.0.1_linux_x86_64.tar.gz | tar xz\ncurl -L https://github.com/sgreben/image-palette-tools/releases/download/0.0.1/cluster-by-palette_0.0.1_linux_x86_64.tar.gz | tar xz\n\n# OS X\ncurl -L https://github.com/sgreben/image-palette-tools/releases/download/0.0.1/extract-palette_0.0.1_osx_x86_64.tar.gz | tar xz\ncurl -L https://github.com/sgreben/image-palette-tools/releases/download/0.0.1/cluster-by-palette_0.0.1_osx_x86_64.tar.gz | tar xz\n\n# Windows\ncurl -LO https://github.com/sgreben/image-palette-tools/releases/download/0.0.1/extract-palette_0.0.1_windows_x86_64.zip\nunzip extract-palette_0.0.1_windows_x86_64.zip\n\ncurl -LO https://github.com/sgreben/image-palette-tools/releases/download/0.0.1/cluster-by-palette_0.0.1_windows_x86_64.zip\nunzip cluster-by-palette_0.0.1_windows_x86_64.zip\n```\n\n## Use it\n\n### `extract-palette`\n\n```text\nUsage of extract-palette:\n  -k int\n        number of colors to extract (default 8)\n  -out-json value\n        path of output JSON file (go template)\n  -out-png value\n        path of output palette image (PNG) (go template)\n  -out-png-height int\n        size of each color square in the palette output image (default 100)\n  -out-txt value\n        path of output text file (go template)\n  -p int\n        number of images to process in parallel (default 8)\n```\n\n#### Examples\n\n\u003e For each image file, extract an 8-color palette. Generate a PNG image of the palette with suffix `-palette-8.png`. Write a JSON file containing the palette colors to a file with suffix `-palette-8.json`.\n\n```sh\nextract-palette \\\n      -k 8 \\\n      -out-png '{{.Path}}-pallette-{{.K}}.png' \\\n      -out-json '{{.Path}}-pallette-{{.K}}.json' \\\n      *.jpg\n```\n\n### `cluster-by-palette`\n\n```text\nUsage of cluster-by-palette:\n  -n int\n        number of image clusters to make (default 5)\n  -glob value\n        glob expression matching image files to cluster\n  -k int\n        palette size (default 4)\n  -out-shell value\n        shell command to run for each image (go template)\n  -out-summary-json value\n        path of output JSON containing the clustering (go template)\n  -out-cluster-png value\n        output path for cluster palette image (PNG) (go template)\n  -out-cluster-png-height int\n        size of each color square in the palette output image (default 100)\n  -in-json value\n        path to read palette JSON from (go template)\n  -out-json value\n        path to write palette JSON to (go template)\n  -p int\n        number of images to process in parallel (default 8)\n```\n\n#### Examples\n\n\n\u003e Create 8 clusters of images based on their 4-color palettes. Make directories `cluster-0`...`cluster-7` and copy the files to their respective cluster's directory. For each cluster, create PNG palette images named `cluster-8-0.png`...`cluster-8-7.png`.\n\n```sh\ncluster-by-palette \\\n      -n 8 \\\n      -k 4 \\\n      -out-shell 'd=\"cluster-{{.Label}}\"; mkdir -p \"$d\"; cp \"{{.Path}}\" \"$d\"' \\\n      -out-cluster-png \"cluster-{{.N}}-{{.Label}}.png\" \\\n      *.jpg\n```\n\n## Comments\n\nFeel free to [leave a comment](https://github.com/sgreben/image-palette-tools/issues/1) or create an issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgreben%2Fimage-palette-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsgreben%2Fimage-palette-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgreben%2Fimage-palette-tools/lists"}