Skip to content

v2.5.0 Slicer thumbnail preview

Compare
Choose a tag to compare
@remcoder remcoder released this 14 Sep 20:39
· 731 commits to develop since this release

This release extends the gcode parser to detect and parse thumbnail previews as generated by PrusaSlicer. In the gcode these are found in comments, enclosed between 'thumbnail begin' and 'thumbnail end'. The images are encoded as base64 strings but split over multiple lines. These are now parsed and patched back together, but still kept a base64. This allows easy use in the browser for us as data urls.

image

The thumbnails can be accessed like this:
gcodePreview.parser.metadata.thumbnails['220x124']

Thumbnails have a .src property that will create a usable data url from the base64 string.

See an example in the demo source.