Extracting a thumbnail from Gcode

As a user, I want to save a preview image (in some format) into the gcode when slicing. If I save an image into the gcode, I want to be able to see it in the list and details of gcode files in Karmen.

Currently, we prefer extracting images from PrusaSlicer, but we want to prepare the solution so that previews can be extracted from other slicers as well (Cura, Slic3r…).

The image from the gcode will be extracted immediately upon its upload.

At the moment, the API part is being addressed, meaning that the API should return the image if it exists.

Notes:

  • The thumbnail is stored as a comment.
  • The data is probably a PNG bitmap in Base64.
  • The thumbnail search will probably only be done on the first, for example, 1500 lines of gcode.
  • The thumbnails will be saved to disk and will be available via HTTP as static files (with appropriate permissions).