Skip to content

Small tool to analyse and extract thumbnails rendered into GCODE files

OctoPrint/gcode-thumbnail-tool

Repository files navigation

gcode-thumbnail-tool

A small tool to analyse and extract thumbnails rendered into GCODE files.

Installation

pip install gcode-thumbnail-tool

Usage

As a Python library

import gcode_thumbnail_tool as gtt

path = "/path/to/a/file.gcode"
thumbnails = gtt.extract_thumbnails_from_gcode_file(path)

if result:
    print(
        f'Found {len(result.images)} thumbnails in {args.path}, in format "{result.extractor}":'
    )
    for image in result.images:
        print(f"\t{image.format} @ {image.width}x{image.height}")
else:
    print(f"Didn't find any thumbnails in {args.path}")

See gcode_thumbnail_tool.py:main and tests/test_api.py for more usage examples.

As a command line tool

usage: gcode-thumbnail-tool [-h] [--verbose] {extract,analyse} ...

A small CLI tool to extract thumbnail images from GCODE files.

positional arguments:
  {extract,analyse}
    extract          extracts thumbnails from the provided file as PNGs
    analyse          provides information on the GCODE file's thumbnails

options:
  -h, --help         show this help message and exit
  --verbose, -v      increase logging verbosity

extract

usage: gcode-thumbnail-tool extract [-h] [-o OUTPUT] path

positional arguments:
  path                  path to the GCODE file

options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output OUTPUT
                        output path for the extracted thumbnails

analyse

usage: gcode-thumbnail-tool analyse [-h] path

positional arguments:
  path        path to the GCODE file

options:
  -h, --help  show this help message and exit

About

Small tool to analyse and extract thumbnails rendered into GCODE files

Resources

Stars

Watchers

Forks

Packages

No packages published