{"id":15654362,"url":"https://github.com/minimaxir/tritonize","last_synced_at":"2025-07-09T20:33:07.202Z","repository":{"id":65982450,"uuid":"81912829","full_name":"minimaxir/tritonize","owner":"minimaxir","description":"Convert images to a styled, minimal representation, quickly with NumPy","archived":false,"fork":false,"pushed_at":"2017-08-28T06:23:04.000Z","size":5534,"stargazers_count":27,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-30T22:49:47.530Z","etag":null,"topics":["image-processing","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/minimaxir.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-02-14T06:27:18.000Z","updated_at":"2024-04-13T13:39:53.000Z","dependencies_parsed_at":"2023-02-19T18:31:13.144Z","dependency_job_id":null,"html_url":"https://github.com/minimaxir/tritonize","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/minimaxir/tritonize","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minimaxir%2Ftritonize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minimaxir%2Ftritonize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minimaxir%2Ftritonize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minimaxir%2Ftritonize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/minimaxir","download_url":"https://codeload.github.com/minimaxir/tritonize/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/minimaxir%2Ftritonize/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264502666,"owners_count":23618671,"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":["image-processing","python"],"created_at":"2024-10-03T12:51:08.770Z","updated_at":"2025-07-09T20:33:07.175Z","avatar_url":"https://github.com/minimaxir.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tritonize\n![](tritonize_collage.png)\n\n**tritonize** is a Python 2.7/3.6 script which allows users to convert images to a styled, minimal representation, quickly with NumPy, even on large 12MP+ images. The script uses [sigmoid](https://en.wikipedia.org/wiki/Sigmoid_function) thresholding to split a given image into 3 (or more) regions of distinct colors, and applies user-defined colors to the image instead; this transformation results in a style similar to that of the famous [Barack Obama \"Hope\" poster](https://en.wikipedia.org/wiki/Barack_Obama_%22Hope%22_poster).\n\nYou can also use transparent RGBA colors to make semitransparent images, which can be placed on top of a solid background or gradient like `spring`, `Spectral`, and `inferno` for even cooler effects:\n\n![](tritonize_collage_gradient.png)\n\nThe script will generate images and store them in a `tritonize` folder for each possible permutation of the given colors such that the user can choose the best result: for 3 colors, that is 6 images; for 4 colors, 24 images; for 5 colors, 120 images.\n\n## Usage\n\nThe `tritonize` script is used from the command line:\n\n```shell\npython tritonize.py -i Lenna.png -c \"#1a1a1a\" \"#FFFFFF\" \"#2c3e50\" -b 10\n```\n\n```shell\npython tritonize.py -i Lenna.png -c \"(0, 0, 0, 0)\" \"(26, 26, 26, 255)\" \"(255, 255, 255, 255)\" -b 4 -p \"spring\"\n```\n\n* the `-i/--image` required parameter specifies the image file.\n* the `-c/--color` required parameter specified the color, followed by quote-wrapped hexidecimal, 3-element RGB, or 4-element RGBA color representations. [NB: the last RGBA parameter is scaled from 0 to 255]\n* the `-b/--blur` optional parameter controls the blur strength per megapixel (default: 4)\n* the `-bg/--background` optional parameter sets the background color (only relevant if any colors are transparent)\n* the `-p/--palette` optional parameter sets a horizontal gradient using a palette from the matplotlib palettes (only relevant if any colors are transparent)\n\nSee the `examples` folder for more examples.\n\n## Requirements\nnumpy, scipy, PIL/Pillow, matplotlib\n\n## Todo\n\n* Add direction changing of gradient\n\n## Maintainer\nMax Woolf ([@minimaxir](http://minimaxir.com))\n\n## Credits\nUser martineau on Stack Overflow for [an easy method](http://stackoverflow.com/a/4296727) of converting color hex strings to triplets.\n\n## License\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminimaxir%2Ftritonize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fminimaxir%2Ftritonize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fminimaxir%2Ftritonize/lists"}