{"id":34668214,"url":"https://github.com/manuelhe/markov-image-generator","last_synced_at":"2026-05-01T08:32:58.772Z","repository":{"id":307587933,"uuid":"1030029014","full_name":"manuelhe/markov-image-generator","owner":"manuelhe","description":"Markov chain image generator","archived":false,"fork":false,"pushed_at":"2025-08-07T00:38:13.000Z","size":564,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-26T08:37:08.117Z","etag":null,"topics":["color-quantization","image-generation","image-processing","javascript","machine-learning","markov-chains","pixel-art"],"latest_commit_sha":null,"homepage":"https://morra.co/markov-image-generator/","language":"CSS","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/manuelhe.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-08-01T01:25:50.000Z","updated_at":"2025-08-07T00:38:16.000Z","dependencies_parsed_at":"2025-08-01T03:29:23.520Z","dependency_job_id":"2fd3cf60-7e4f-448d-a443-36c864e4ab5d","html_url":"https://github.com/manuelhe/markov-image-generator","commit_stats":null,"previous_names":["manuelhe/markov-image-generator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/manuelhe/markov-image-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelhe%2Fmarkov-image-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelhe%2Fmarkov-image-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelhe%2Fmarkov-image-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelhe%2Fmarkov-image-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manuelhe","download_url":"https://codeload.github.com/manuelhe/markov-image-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manuelhe%2Fmarkov-image-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32490810,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"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":["color-quantization","image-generation","image-processing","javascript","machine-learning","markov-chains","pixel-art"],"created_at":"2025-12-24T19:42:25.782Z","updated_at":"2026-05-01T08:32:58.754Z","avatar_url":"https://github.com/manuelhe.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Markov Image Generator\n\nThis project is a web-based application that generates unique pixel art images using a Markov chain model. Users can upload their own images to train the model, and then generate new images based on the learned patterns.\n\n## Demo\n\nTest this application online [here](https://morra.co/markov-image-generator/).\n\n![Generated example image](https://github.com/manuelhe/markov-image-generator/blob/main/assets/android-chrome-512x512.png)\n\n## Features\n\n- **Image Upload:** Upload multiple images to be used as a basis for training the Markov chain model.\n- **Color Quantization:** Reduce the color palette of the source images to a specified number of colors using K-means clustering.\n- **Markov Chain Learning:** The application builds a Markov chain model from the uploaded images, learning the probabilistic transitions between adjacent pixel colors.\n- **Image Generation:** Generate new images of a specified width and height based on the learned Markov chain model.\n- **Download Image:** Download the generated image as a PNG file.\n\n## How It Works\n\nThe process of generating a new image can be broken down into the following steps:\n\n1.  **Image Preprocessing:**\n    *   The user uploads one or more base images.\n    *   The application resizes the images to a uniform dimension.\n    *   The colors of the images are quantized to a smaller, representative palette using a K-means clustering algorithm. This simplifies the color space and helps to create a more coherent final image.\n\n2.  **Markov Chain Model Training:**\n    *   The application iterates through each pixel of the preprocessed source images.\n    *   It builds a transition matrix (the Markov chain) that records the probability of one color appearing next to another, both horizontally and vertically.\n\n3.  **Image Generation:**\n    *   A new image is started with a random color from the learned palette.\n    *   Each subsequent pixel is chosen based on the color of its left and top neighbors, using the probabilities stored in the Markov chain.\n    *   If a pixel has no learned transitions (e.g., at the edges), a random color is chosen from the palette.\n\n## Technologies Used\n\n-   **HTML5:** For the structure of the web page.\n-   **Tailwind CSS:** For styling the user interface.\n-   **JavaScript (ES6+):** For all the application logic, including the image processing, Markov chain implementation, and user interaction.\n\n## How to Use\n\n1.  **Upload Images:** Click the \"Upload Base Images\" button and select one or more images from your computer.\n2.  **Set Parameters:**\n    *   **Target Color Count:** Choose the number of colors you want in the final image's palette.\n    *   **Target Width \u0026 Height:** Set the dimensions of the generated image.\n3.  **Process Images \u0026 Learn:** Click the \"Process Images \u0026 Learn\" button to start the training process.\n4.  **Generate New Image:** Once the model is trained, click the \"Generate New Image\" button to create a new image.\n5.  **Download Image:** Click the \"Download Image\" button to save the generated image to your computer.\n\n## File Structure\n\n-   `index.html`: The main HTML file that defines the structure of the web application.\n-   `script.js`: Contains all the JavaScript code for the application, including the UI logic, image processing, and Markov chain implementation.\n-   `input.css`: The main stylesheet for the application.\n-   `README.md`: This file.\n\n## Future Improvements\n\n-   Implement different transition models (e.g., considering diagonal neighbors).\n-   Allow users to save and load their trained Markov chain models.\n-   Add more sophisticated color quantization algorithms.\n-   Improve the user interface and provide more feedback during the training process.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanuelhe%2Fmarkov-image-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanuelhe%2Fmarkov-image-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanuelhe%2Fmarkov-image-generator/lists"}