v2.5.0 Slicer thumbnail preview
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.
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.