{"id":50955575,"url":"https://github.com/offerrall/pygrbl_build","last_synced_at":"2026-06-18T06:03:01.991Z","repository":{"id":364548395,"uuid":"1268326345","full_name":"offerrall/pygrbl_build","owner":"offerrall","description":"A collection of algorithms to generate G-code for GRBL diode lasers from different sources.","archived":false,"fork":false,"pushed_at":"2026-06-13T12:12:42.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-13T14:08:48.869Z","etag":null,"topics":["c","gcode","gcode-generation","l2l","python","svg"],"latest_commit_sha":null,"homepage":"","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/offerrall.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-13T11:58:22.000Z","updated_at":"2026-06-13T12:12:46.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/offerrall/pygrbl_build","commit_stats":null,"previous_names":["offerrall/pygrbl_build"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/offerrall/pygrbl_build","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offerrall%2Fpygrbl_build","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offerrall%2Fpygrbl_build/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offerrall%2Fpygrbl_build/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offerrall%2Fpygrbl_build/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/offerrall","download_url":"https://codeload.github.com/offerrall/pygrbl_build/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/offerrall%2Fpygrbl_build/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34478108,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-18T02:00:06.871Z","response_time":128,"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":["c","gcode","gcode-generation","l2l","python","svg"],"created_at":"2026-06-18T06:03:01.351Z","updated_at":"2026-06-18T06:03:01.983Z","avatar_url":"https://github.com/offerrall.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyGrbl_Build 0.2.0\n\n[![PyPI](https://img.shields.io/pypi/v/pygrbl_build.svg)](https://pypi.org/project/pygrbl_build/)\n\nA collection of algorithms to generate **G-code for GRBL diode lasers**\nfrom different sources. Four algorithms today:\n\n- **Line-to-Line** (`l2l_gcode`) — raster engraving from an image, with\n  LaserGRBL fidelity.\n- **SVG vector** (`svg_gcode`) — vector tracing from an SVG (paths,\n  basic shapes, groups, transforms), a faithful port of LaserGRBL's SVG\n  import. Pure Python, no extra dependency.\n- **Image vector** (`img2vector_gcode`) — outline tracing from a raster\n  image (LaserGRBL's \"Vectorize!\"): the image is reduced to black/white,\n  Potrace traces its outlines as closed contours, and each curve is\n  emitted as G2/G3 arcs. Pure Python, Pillow only. Outlines only today\n  (no interior filling yet).\n- **Image to SVG** (`img2svg`) — the same Potrace trace as\n  `img2vector_gcode`, but the contours are written to a standard vector\n  SVG instead of G-code. Inner contours become holes (`fill-rule`\n  `evenodd`), so you get the filled black silhouette potrace.exe produces.\n  Pure Python, Pillow only.\n\nPart of the **pygrbl** family, a set of libraries to manage GRBL.\nCompanion to [`pygrbl_streamer`](https://github.com/offerrall/pygrbl_streamer)\n\n## Speed\n\nThis is the whole point. A full 300 mm @ 10 lines/mm raster job — nearly\n**4.7 million lines** of G-code — comes out in **~0.34 s**. LaserGRBL can\ntake around **2 minutes** to produce the same job: that's roughly a\n**350× speedup**, and byte-for-byte the same output.\n\n## Install\n\n```\npip install pygrbl-build\n```\n\n**The only requirements are Pillow and a C compiler.** Pillow is the\nsingle Python dependency (image loading and resizing); the C compiler is\nneeded at install time because the raster engine ships as a C extension.\nNothing else — no numpy, no runtime toolchain.\n\n## Usage\n\nEach algorithm pairs a `*_gcode` generator with its own `*Profile`\nconfig, so adding one never touches the others.\n\nRaster Line-to-Line (`l2l_gcode` + `L2LProfile`):\n\n```python\nfrom pygrbl_build import L2LProfile, l2l_gcode, write_gcode\n\nprofile = L2LProfile(width_mm=300.0, lines_per_mm=10.0, feed=3000, s_max=100)\nwrite_gcode(l2l_gcode(\"shield.png\", profile), \"shield.nc\")\n```\n\nSVG vector (`svg_gcode` + `SvgProfile`):\n\n```python\nfrom pygrbl_build import SvgProfile, svg_gcode, write_gcode\n\nprofile = SvgProfile(feed=1000, s_max=255)\nwrite_gcode(svg_gcode(\"logo.svg\", profile), \"logo.nc\")\n```\n\n`SvgProfile`'s defaults reproduce LaserGRBL's own SVG-import defaults, so\nthe output matches the desktop app for the same drawing. `text` and\n`image` elements are skipped — convert text to paths in your editor\nfirst.\n\nImage vector (`img2vector_gcode` + `Img2VectorProfile`):\n\n```python\nfrom pygrbl_build import Img2VectorProfile, img2vector_gcode, write_gcode\n\nprofile = Img2VectorProfile(width_mm=80.0, quality=10.0, feed=1000, s_max=1000)\nwrite_gcode(img2vector_gcode(\"logo.png\", profile), \"logo.nc\")\n```\n\n`img2vector_gcode` is a faithful port of LaserGRBL's \"Vectorize!\": the\nimage is reduced to black/white (resize, grayscale, white-clip, optional\nthreshold), Potrace traces its outlines, and each cubic Bezier is\napproximated by biarcs and emitted as `G2`/`G3` arcs (with a `G1`\nfallback). `width_mm` sets the physical width and `quality` the tracing\nresolution in pixels/mm. The `Img2VectorProfile` defaults follow Potrace's\nclassic settings (smooth curves, optimization on); set `alphamax=0.0` and\n`opticurve=False` to mimic LaserGRBL's own out-of-the-box UI defaults.\n\nImage to SVG (`img2svg` + `Img2SvgProfile`):\n\n```python\nfrom pygrbl_build import Img2SvgProfile, img2svg\n\nprofile = Img2SvgProfile(width_mm=80.0, quality=10.0)\nsvg = img2svg(\"logo.png\", profile)\nwith open(\"logo.svg\", \"w\", encoding=\"utf-8\") as f:\n    f.write(svg)\n```\n\n`img2svg` runs the same trace as `img2vector_gcode` (resize, grayscale,\nwhite-clip, optional threshold, then Potrace outlines), but skips the\nbiarc/G-code stages and writes the contours as a single filled `\u003cpath\u003e`.\nIt returns the complete SVG document as a string (not a G-code iterator,\nso use your own `open()`). The `Img2SvgProfile` carries only the tracing\nand binarization knobs — no feed, power or laser-mode fields. `viewBox`\nis in pixels (`width_mm*quality`) while `width`/`height` carry the\nphysical size in mm, and the image keeps its natural top-down\norientation (no Y-flip, unlike the G-code path).\n\n`write_gcode` writes the path verbatim, so you choose the extension\n(`.nc`, `.gcode`, `.g`, ...). It's just a convenience: every `*_gcode`\ngenerator is a lazy iterator of lines, so anything beyond writing a\nplain file (compression, network shipping, streaming to the machine) is\nthe upper layer's job — consume the iterator with whatever sink you need.\n\nPublic API: `L2LProfile`, `l2l_gcode`, `SvgProfile`, `svg_gcode`,\n`Img2VectorProfile`, `img2vector_gcode`, `Img2SvgProfile`, `img2svg`,\n`write_gcode`. See the docstrings.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofferrall%2Fpygrbl_build","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fofferrall%2Fpygrbl_build","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fofferrall%2Fpygrbl_build/lists"}