{"id":27223641,"url":"https://github.com/alextopher/autopixel","last_synced_at":"2025-04-10T09:34:31.399Z","repository":{"id":210209325,"uuid":"726010555","full_name":"Alextopher/autopixel","owner":"Alextopher","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-26T18:05:44.000Z","size":427,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-26T19:24:12.576Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pixel.mahoney.best","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/Alextopher.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-12-01T10:45:57.000Z","updated_at":"2024-04-26T18:05:48.000Z","dependencies_parsed_at":"2024-04-25T18:28:47.239Z","dependency_job_id":"f3d87389-d46e-461e-a8a2-4fa983abfcf6","html_url":"https://github.com/Alextopher/autopixel","commit_stats":null,"previous_names":["alextopher/autopixel"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alextopher%2Fautopixel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alextopher%2Fautopixel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alextopher%2Fautopixel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alextopher%2Fautopixel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alextopher","download_url":"https://codeload.github.com/Alextopher/autopixel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248192098,"owners_count":21062627,"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":[],"created_at":"2025-04-10T09:34:30.828Z","updated_at":"2025-04-10T09:34:31.373Z","avatar_url":"https://github.com/Alextopher.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Auto-Pixel\n\n![example](image.png)\n\nAt my school's Computer Science 1 class students learn some basic programming concepts by drawing pixel art programs on [OpenProcessing](https://www.openprocessing.org/), in p5.js. This project is a bit tedious for some students, and it might run counter to the goal of using computers to automate tedious tasks.\n\nI made this small project to show off what a little bit of math and computer science knowledge can do.\n\nAuto-Pixel is a program that takes any image, and converts it into a p5.js program that draws the image as pixel art.\n\n## How it works\n\nThe program follows these steps:\n\n1. Pixelate the image\n2. Reduce the number of colors with [k-means clustering](https://en.wikipedia.org/wiki/K-means_clustering)\n3. Find rectangles of pixels that are the same color [quad-tree decomposition](https://en.wikipedia.org/wiki/Quadtree)\n4. Quad-tree nodes are all squares, we optimize by combining adjacent squares into rectangles\n5. Write p5.js code to draw the rectangles\n\n## How to use\n\nDependency management in python is more complicated than I want to support. If you want to use this, you'll have to install the dependencies yourself.\n\n`pixelate.py` requires [OpenCV](https://opencv.org/) and [NumPy](https://numpy.org/).\n\n```cli\nusage: pixelate.py [-h] -o OUTPUT [-c COLORS] [-s SIZE] [-v] [-d] [--no-optimize] FILE [FILE ...]\n\nPixelate an image.\n\npositional arguments:\n  FILE                  Input files to process\n\noptions:\n  -h, --help            show this help message and exit\n  -o OUTPUT, --output OUTPUT\n                        Output directory\n  -c COLORS, --colors COLORS\n                        Number of colors\n  -s SIZE, --size SIZE  Pixel size\n  -v, --verbose         Enable verbose output\n  -d, --debug           Enable debug output\n  --no-optimize         Disable optimization\n```\n\n## Flask App\n\nAuto-Pixel can also be used as a small Flask webapp. To run the app, run `app.py` and navigate to `http://localhost:5000/`. This repository also includes an example Dockerfile and docker-compose file, I use that container to run on my own server at \u003chttps://pixel.mahoney.best\u003e.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falextopher%2Fautopixel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falextopher%2Fautopixel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falextopher%2Fautopixel/lists"}