gcode2image


Namegcode2image JSON
Version 2.4.2 PyPI version JSON
download
home_pageNone
Summarygcode2image: convert gcode to image.
upload_time2024-02-07 13:27:21
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords engraving laser image laser engraving pwm gcode
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # gcode2image

Commanline tool to convert gcode to pixel exact image files.

This 2D viewer - images are 2D (no Z coordinates) - has as strong points that it shows gray levels and thus is able to show a realistic representation of laser engravings. Images can be viewed while converting gcode and the exact placing and size of the gcode can be shown. Since version 2.4.0 repeated writes to the same pixel locations can be shown (option --incremental). This means that the simulated engraving is pretty close to actual laser engraving.
It is also possible to show speed movement *G0* code.

A typical command:
```gcode2image --showimage --flip test.gc test.png```

This converts gcode file ```test.gc``` to image file ```test.png```. (You can change the image file extension to *.jpg* or other, to get another image file format.) It shows the result image in an external viewer (platform dependent) and flips the image upside down because the gcode coordinate system and image coordinate system differ.

To get a precise idea of the location and orientation of the gcode, the following options can be used:

```gcode2image --showimage --flip --showorigin --grid test.gc test.png```

This generates a 1 cm (per axis) grid and shows the origin X0Y0.

*gcode2image* can be used alongside *grblhud*, *image2gcode* and *svg2gcode* for a commandline driven workflow. (https://github.com/johannesnoordanus/.)

Please consider supporting me, so I can make this application better and add new functionality to it: <http://paypal.me/johannesnoordanus/5,00>

### Install:
Depends on python libraries numpy and PIL.
*pip install* takes care of that.
```
> pip install gcode2image
```
Note that some managed linux distributions do not allow system wide installs using *pip*, in that case use *pipx*:
```
> pipx install gcode2image
```
### Usage:
```
$ gcode2image --help
usage: gcode2image [-h] [--resolution <default: 0.1>] [--maxintensity <default: 255>] [--showimage] [--showG0] [--showorigin] [--flip] [--grid] [--incremental] [-V]
                   gcode image

Convert a gcode file to image.

positional arguments:
  gcode                 name of gcode file to convert
  image                 image out

options:
  -h, --help            show this help message and exit
  --resolution <default: 0.1>
                        define image resolution by pixel size (mm^2)
  --maxintensity <default: 255>
                        set maximum intensity for this image, typically 'max laser power' of the source gcode file
  --showimage           show b&w converted image
  --showG0              show G0 moves
  --showorigin          show image origin (0,0)
  --flip                flip image updown
  --grid                show a grid 10mm wide
  --incremental         show incremental burns
  -V, --version         show version number and exit
```
### Example:
A rectangle in gcode:
```
M4 S300         ; set write mode (constant burn) and intensity
G0 X0Y0         ; move head to X0 Z0
G1 X25          ; move head to X25 and burn with intensity 300 (moves head on the X-axis)
G1 Y25          ; move head to Y25 and burn with intensity 300  (moves head on the Y-axis)
G1 X0           ; move head to X0 and burn with intensity 300  (moves head back on X-axis)
G1 Y0           ; moves head to Y0 and burn with intensity 300 (moves head beck on the Y-axis)
```

Make a file 'testje.gc' (for example) and add the above lines.
Run it:
```gcode2image --showimage --flip testje.gc testje.png```

This results in image file ```testje.png``` that has the square at the borders (note that gcode2image outputs the minimum number of pixels in X and Y)

If you add the below line at the end of the gcode file, an extra line from (0,0) to the centre of the image will show up.
This will make it easier to see the result.

```G1 X12.5Y12.5   ; move head to centre and burn with intensity```

```gcode2image --showimage --flip --showorigin --grid --showG0 testje.gc testje.png```

This will show the origin (X0Y0), a grid and the gcode image containing a line from the origin to the centre of the screen.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "gcode2image",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "engraving,laser,image,laser engraving,PWM,gcode",
    "author": null,
    "author_email": "Johannes Noordanus <mailjohannes.mailnoordanus@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/ef/de/05858f9b2baed1ced4e8b68153889180315da39c9dc0949d07c3c6c8e4d9/gcode2image-2.4.2.tar.gz",
    "platform": null,
    "description": "# gcode2image\n\nCommanline tool to convert gcode to pixel exact image files.\n\nThis 2D viewer - images are 2D (no Z coordinates) - has as strong points that it shows gray levels and thus is able to show a realistic representation of laser engravings. Images can be viewed while converting gcode and the exact placing and size of the gcode can be shown. Since version 2.4.0 repeated writes to the same pixel locations can be shown (option --incremental). This means that the simulated engraving is pretty close to actual laser engraving.\nIt is also possible to show speed movement *G0* code.\n\nA typical command:\n```gcode2image --showimage --flip test.gc test.png```\n\nThis converts gcode file ```test.gc``` to image file ```test.png```. (You can change the image file extension to *.jpg* or other, to get another image file format.) It shows the result image in an external viewer (platform dependent) and flips the image upside down because the gcode coordinate system and image coordinate system differ.\n\nTo get a precise idea of the location and orientation of the gcode, the following options can be used:\n\n```gcode2image --showimage --flip --showorigin --grid test.gc test.png```\n\nThis generates a 1 cm (per axis) grid and shows the origin X0Y0.\n\n*gcode2image* can be used alongside *grblhud*, *image2gcode* and *svg2gcode* for a commandline driven workflow. (https://github.com/johannesnoordanus/.)\n\nPlease consider supporting me, so I can make this application better and add new functionality to it: <http://paypal.me/johannesnoordanus/5,00>\n\n### Install:\nDepends on python libraries numpy and PIL.\n*pip install* takes care of that.\n```\n> pip install gcode2image\n```\nNote that some managed linux distributions do not allow system wide installs using *pip*, in that case use *pipx*:\n```\n> pipx install gcode2image\n```\n### Usage:\n```\n$ gcode2image --help\nusage: gcode2image [-h] [--resolution <default: 0.1>] [--maxintensity <default: 255>] [--showimage] [--showG0] [--showorigin] [--flip] [--grid] [--incremental] [-V]\n                   gcode image\n\nConvert a gcode file to image.\n\npositional arguments:\n  gcode                 name of gcode file to convert\n  image                 image out\n\noptions:\n  -h, --help            show this help message and exit\n  --resolution <default: 0.1>\n                        define image resolution by pixel size (mm^2)\n  --maxintensity <default: 255>\n                        set maximum intensity for this image, typically 'max laser power' of the source gcode file\n  --showimage           show b&w converted image\n  --showG0              show G0 moves\n  --showorigin          show image origin (0,0)\n  --flip                flip image updown\n  --grid                show a grid 10mm wide\n  --incremental         show incremental burns\n  -V, --version         show version number and exit\n```\n### Example:\nA rectangle in gcode:\n```\nM4 S300         ; set write mode (constant burn) and intensity\nG0 X0Y0         ; move head to X0 Z0\nG1 X25          ; move head to X25 and burn with intensity 300 (moves head on the X-axis)\nG1 Y25          ; move head to Y25 and burn with intensity 300  (moves head on the Y-axis)\nG1 X0           ; move head to X0 and burn with intensity 300  (moves head back on X-axis)\nG1 Y0           ; moves head to Y0 and burn with intensity 300 (moves head beck on the Y-axis)\n```\n\nMake a file 'testje.gc' (for example) and add the above lines.\nRun it:\n```gcode2image --showimage --flip testje.gc testje.png```\n\nThis results in image file ```testje.png``` that has the square at the borders (note that gcode2image outputs the minimum number of pixels in X and Y)\n\nIf you add the below line at the end of the gcode file, an extra line from (0,0) to the centre of the image will show up.\nThis will make it easier to see the result.\n\n```G1 X12.5Y12.5   ; move head to centre and burn with intensity```\n\n```gcode2image --showimage --flip --showorigin --grid --showG0 testje.gc testje.png```\n\nThis will show the origin (X0Y0), a grid and the gcode image containing a line from the origin to the centre of the screen.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "gcode2image: convert gcode to image.",
    "version": "2.4.2",
    "project_urls": {
        "Home": "https://github.com/johannesnoordanus/gcode2image"
    },
    "split_keywords": [
        "engraving",
        "laser",
        "image",
        "laser engraving",
        "pwm",
        "gcode"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "9468044c7e03662e1080995f205bb0fc725d5d46e5eb67022cfe05e16382f69a",
                "md5": "7362d337a9099f4405892008ac4fae62",
                "sha256": "40d06c034235120690c3ad0e84c155403521cd0dabdca1644e22781013bc8472"
            },
            "downloads": -1,
            "filename": "gcode2image-2.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7362d337a9099f4405892008ac4fae62",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 8256,
            "upload_time": "2024-02-07T13:27:16",
            "upload_time_iso_8601": "2024-02-07T13:27:16.245611Z",
            "url": "https://files.pythonhosted.org/packages/94/68/044c7e03662e1080995f205bb0fc725d5d46e5eb67022cfe05e16382f69a/gcode2image-2.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "efde05858f9b2baed1ced4e8b68153889180315da39c9dc0949d07c3c6c8e4d9",
                "md5": "e391e84077ba8e38cf76e23e45c2208f",
                "sha256": "700daf749d27f7fe690eaff3364b59ac898fac9fc01530705e93618a7713add9"
            },
            "downloads": -1,
            "filename": "gcode2image-2.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "e391e84077ba8e38cf76e23e45c2208f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 7451,
            "upload_time": "2024-02-07T13:27:21",
            "upload_time_iso_8601": "2024-02-07T13:27:21.539353Z",
            "url": "https://files.pythonhosted.org/packages/ef/de/05858f9b2baed1ced4e8b68153889180315da39c9dc0949d07c3c6c8e4d9/gcode2image-2.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-07 13:27:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "johannesnoordanus",
    "github_project": "gcode2image",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "gcode2image"
}
        
Elapsed time: 0.18265s