{"id":17912730,"url":"https://github.com/stypox/image-to-gcode","last_synced_at":"2026-03-09T19:02:03.578Z","repository":{"id":128744087,"uuid":"236350379","full_name":"Stypox/image-to-gcode","owner":"Stypox","description":"Detects the edges of an image and converts them to 2D gcode that can be printed by a plotter","archived":false,"fork":false,"pushed_at":"2021-06-23T16:04:16.000Z","size":194,"stargazers_count":28,"open_issues_count":1,"forks_count":12,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-19T00:06:57.575Z","etag":null,"topics":["edge-detection","gcode","gcode-generation","image-to-gcode"],"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/Stypox.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,"publiccode":null,"codemeta":null}},"created_at":"2020-01-26T17:42:44.000Z","updated_at":"2025-02-21T15:52:12.000Z","dependencies_parsed_at":"2023-03-26T01:34:32.136Z","dependency_job_id":null,"html_url":"https://github.com/Stypox/image-to-gcode","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/Stypox%2Fimage-to-gcode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stypox%2Fimage-to-gcode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stypox%2Fimage-to-gcode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Stypox%2Fimage-to-gcode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Stypox","download_url":"https://codeload.github.com/Stypox/image-to-gcode/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245180391,"owners_count":20573663,"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":["edge-detection","gcode","gcode-generation","image-to-gcode"],"created_at":"2024-10-28T19:46:44.806Z","updated_at":"2026-03-09T19:01:58.556Z","avatar_url":"https://github.com/Stypox.png","language":"Python","readme":"# Image to G-code converter\n\nThis repository contains a Python 3 script that takes an **image as input** and generates a **2D G-code file as output**. The script can either use the provided image as an edges image, or auto-detect the edges using the Sobel operator. Then a graph is built and it is converted to G-code. You can then **use the produced G-code in a 2D plotter**, you may find this other project of mine useful: [plotter](https://github.com/Stypox/plotter).\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003cth colspan=2\u003eAuto-detecting edges\u003c/th\u003e\n\u003cth colspan=2\u003eConsidering image as already edges\u003c/th\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd\u003e\u003cimg width=\"300px\" src=\"./images/tree.png\"/\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cimg width=\"300px\" src=\"./images/tree_gcode.png\"/\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cimg width=\"200px\" src=\"./images/flower.jpg\"/\u003e\u003c/td\u003e\n\u003ctd\u003e\u003cimg width=\"200px\" src=\"./images/flower_gcode.png\"/\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003ctr\u003e\n\u003ctd colspan=4 align=\"center\"\u003eObtained with \u003ca href=\"http://jherrm.com/gcode-viewer/\"\u003ehttp://jherrm.com/gcode-viewer/\u003c/a\u003e\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n## Usage\n\nYou can run the script normally with [Python 3](https://www.python.org/downloads/):\n```\npython3 image_to_gcode.py ARGUMENTS...\n```\nThis is the help screen with all valid arguments (obtainable with `python3 image_to_gcode.py --help`):\n```\nusage: image_to_gcode.py [-h] -i FILE -o FILE [--dot-output FILE] [-e MODE] [-t VALUE]\n\nDetects the edges of an image and converts them to 2D gcode that can be printed by a plotter\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -i FILE, --input FILE\n                        Image to convert to gcode; all formats supported by the Python imageio library are supported\n  -o FILE, --output FILE\n                        File in which to save the gcode result\n  --dot-output FILE     Optional file in which to save the graph (in DOT format) generated during an intermediary step of gcode generation\n  -e MODE, --edges MODE\n                        Consider the input file already as an edges matrix, not as an image of which to detect the edges. MODE should be either `white` or `black`, that is the color of the edges in the image. The image should only be made of white or black pixels.\n  -t VALUE, --threshold VALUE\n                        The threshold in range (0,255) above which to consider a pixel as part of an edge (after Sobel was applied to the image or on reading the edges from file with the --edges option)\n```\n\nThe required parameters are the input and the output. You may want to tune the threshold value in order to obtain a better graph.\n\nAn example of command is:\n```sh\npython3 image_to_gcode.py --input image.png --output graph.nc --threshold 100\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstypox%2Fimage-to-gcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstypox%2Fimage-to-gcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstypox%2Fimage-to-gcode/lists"}