PanelDue Image Display
-
@bot, that would be entirely doable.
-
Cool! The PrusaSlicer fork SuperSlicer has added the functionality to put the thumbnail on non-mini printer profiles. Perhaps a different resolution is possible, as well. We could check the PrusaSlicer/SuperSlicer source.
If another resolution is possible, what would be ideal for the paneldue? I guess we should ensure the smallest paneldues can see the thumbnails. This could be included into the "RepRapFirmware" G-Code flavour that is seemingly soon to be added to PrusaSlicer.
Perhaps DWC could grab these tumbnails, too.
-
Very nice. +1
-
Do you have a link to the specification for the image encoding?
-
I do not think any public documentation of this exists, but here is the first most obvious reference to it that I can find in the source:
Prusa3D/PrusaSlicer/src/libslic3r/GCode.cpp#L981
static void export_thumbnails_to_file(ThumbnailsGeneratorCallback &thumbnail_cb, const std::vector<Vec2d> &sizes, WriteToOutput output, ThrowIfCanceledCallback throw_if_canceled) { // Write thumbnails using base64 encoding if (thumbnail_cb != nullptr) { const size_t max_row_length = 78; ThumbnailsList thumbnails; thumbnail_cb(thumbnails, sizes, true, true, true, true); for (const ThumbnailData& data : thumbnails) { if (data.is_valid()) { size_t png_size = 0; void* png_data = tdefl_write_image_to_png_file_in_memory_ex((const void*)data.pixels.data(), data.width, data.height, 4, &png_size, MZ_DEFAULT_LEVEL, 1); if (png_data != nullptr) { std::string encoded; encoded.resize(boost::beast::detail::base64::encoded_size(png_size)); encoded.resize(boost::beast::detail::base64::encode((void*)&encoded[0], (const void*)png_data, png_size)); output((boost::format("\n;\n; thumbnail begin %dx%d %d\n") % data.width % data.height % encoded.size()).str().c_str()); unsigned int row_count = 0; while (encoded.size() > max_row_length) { output((boost::format("; %s\n") % encoded.substr(0, max_row_length)).str().c_str()); encoded = encoded.substr(max_row_length); ++row_count; } if (encoded.size() > 0) output((boost::format("; %s\n") % encoded).str().c_str()); output("; thumbnail end\n;\n"); mz_free(png_data); } } throw_if_canceled(); } } }
So the thumbnail seems to be encoded in 'base64' by the boost library. The start of the thumbnail says
; thumbnail begin
followed by the pixel resolution and the encoded size. I suppose it's an encoding of a PNG file of some format. -
@dc42 I found this website which can directly decode the image that I posted above, which was merely an example I found on the internet from someone's publicly posted gcode.
https://base64.guru/converter/decode/image/png
Encoded PNG with added information removed:
iVBORw0KGgoAAAANSUhEUgAAANwAAAB8CAYAAAACRt5vAAAJPElEQVR4Ae2d2ZoTVRSF60FsWiFewP dxi4iI2iL3voIiIorzPADP5ouFTneHLkINZ9jD2uesi32TpM5ZWbX+pFKpU3vYbDbXD+vGjRsn+5p6 XqKk57DQHFU3vcbxeljbSEOcxviHY0bVTc16+xLB68FaHAM2P/7/T25vNYpe4+R6sBKobaTWXFq6te BKrZ681pwrd5xBY1BPI6Xm1Tis8YZMC75aryLmo3T7oXTwlAk0QmthiqRmVMg04PP2WkKzdq6Tgcs1 yNvIEoMkPyAiQSYJnofXGhmpfd1cZQOXYhaSkam6CJoueBpee+ajVHcRcEsiEI1cM1VCdySIrMDT8t o6I5Kaq4Abi7t58+bn6EYe6t5pHusuGScSNJ7gRcyHhm4CVwFcJFA8oWslH+7AtXBIeWhoiu5IcHiC t5YPHlJWCEp5Ds3I1OcIWz50El5750Mj1138LZCqZ+01kUDwhE7Ca8R8SOjOAi53MgRTSzRMbRMJAC /opLxGz0iNZl7albBtpOB7loTXUfJRun0XFy+XzkfYyqDz3GfWecwdJ3l5joQBFqZKjh8p6EiFsv8Q c80FqIQNHjqtjEiMmTv+YC1KYx5pzZGC3Sp06BkpnWewFiRthIbuSKFuGTjUfNTMO3iKqjFFS3OkQP cCHVpGajQP3qLmxC1pIWyELicfSLkevAXlmKptZKQQ9whcSgZQQJvTPSCJWjLVwshIIe4VOO+M1Goe NpvNddTaG2extCNSgAmdfT6kCh44iUWiBK5N4MYZIXACRlodLkQKLqGzz4cocOgnTcbaeHaSwC3lAB m8N85SIohLMUvD1Eih7Rm41H2PBt3k3wLeAnM1SGqOFNpegfPMh5Tm185SegmsmVdKc6TQ9ggcQkak NA+e4qTmqx0nUmh7Ag4lH5LzQSzPkZijZrxIoe0FOO18WOR66jVN9YcrNTVSaFsHTh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G1g3dH24fgKhr7SIEgF7bFnxDxsNPXXS9UTXTa5 t6CT7Sg5eV9vIgAAAAAElFTkSuQmCC
Produces this image:
Note that the background uses alpha transparency.
-
Support for the thumbnail included by PrusaSlicer is planned for the version PanelDueFirmware 3.3 (i.e. after the current 3.2 is finished).
-
@wilriker FYI the newest versions of PrusaSlicer include the ability to embed a thumbnail of an arbitrary size. No modifications necessary to get a thumbnail encoded now.
-
I was looking into this for the past week and unfortunately I have to report failure to get it done. The problem is that we just have way to few RAM available on PanelDue. Maybe in future version of PanelDue with much more RAM this could be done for but for now it is technically impossible.
-
@wilriker Unfortunately that makes sense. Thanks for looking into it.
If we're just "together" I would like to see the current pinting speed on PanelDue.
-