Does anyone here work on Superslicer?
-
@oliof throwing my plugin https://github.com/Kriechi/Cura-DuetRRFPlugin/ into the mix as a well-known and popular Duet RRF plugin for Cura.
@dc42 would you mind pointing me towards a spec on how PanelDue wants to read the QOI data from the gcode file? Or is this yet to be defined?
-
@dc42 said in Does anyone here work on Superslicer?:
Does anyone here know their way around the Superslicer/PrusaSlicer source code well enough to make a change? The change I have in mind is that when RepRapFirmware output is selected, the thumbnail images embedded in the GCode file would be in QOI image format (see https://github.com/phoboslab/qoi) instead of .png format. That would enable us to display thumbnail images on PanelDue, because QOI format doesn't need a large RAM buffer to decompress the images.
Hi
I'm the dev of superslicer.
I encourage you to post an issue on the gihub for feature request.
(https://github.com/supermerill/SuperSlicer/issues/new/choose)For changing the output format, currently we use zlib and a better version of https://gist.github.com/908299
Adding the QOI format shouldn't be too hard, from what i can read from their page. Just hoping it will compile without problem on windows, linux & macos.the line to change is Gcode.cpp:941
-
I believe I have a working Cura integration that takes a 320x240 snapshot of the scene, encodes it as QOI, and puts it at the beginning of the gcode file before uploading it.
@dc42 just let me know where or how you want to parse it: special M-code? magic comment?
-
I appreciate the references very much!
But, yeah, merill might be much better at constructing this architecturally. While I'm definitely getting comfortable with the PrusaSlicer codebase, merill has much more experience.
I'd be happy to help with any grunt-work, though. Testing, fixing things up, doing things that dc42 and merill tell me to, etc.
@dc42 if you have any interest in setting up an IDE for working on PrusaSlicer, they use VS 2019, community edition is free and works. I've also got it working under Visual Studio code, with a bunch of cmake plugins and stuff. I'm sure it wouldn't be hard to get it into your IDE of choice, as long as it integrated with cmake to some extent.
Setting the project up in VS 2019 is dead simple, tho. Microsoft aside, the experience of working on PS for the past year and a bit has been fantastic, due largely in part to intellisense guiding me around.
I digress, you know this I bet. But I'd be happy to answer any questions you have about the codebase or do any tedious tasks you need done for features you want.
-
@hestiahuang said in Does anyone here work on Superslicer?:
@dc42 said in Does anyone here work on Superslicer?:
able us to display thumbnail images on Panel
Sounds great! Only SS and PS? How about S3D and IdeaMaker?
Both s3d and IdeaMaker are closed source so none of us can add anything to them. When at least one other slicer support this and the paneldue is parsing this we can request on the s3d and ideamaker forums for them to support this feature too.
Now, s3d is dead so nothing will happen there for sure, IdeaMaker is awesome (my slicer of choice) but they are pretty slow to implement features that are totally unusable for their own printers. They only recently added octoprint integration (they had network upload and network printing with their own custom printers for years) .. but since they already embed some image in gcode if I remember correctly for their own printers this might go faster than octoprint integration
-
@dc42 @resam Ultimaker Cura dev has answered on my feature request, I will copy that here:
I think PNGDec is a much more friendly option for PanelDue. It requires even less memory and the PNG format actually has more than a month of battle-testing behind it. There's a decent chance that this image format gets forgotten as "that nice one from December 2021" like most new image formats. But of course, it's not up to us to decide for them. We just need to try to integrate with all of these printers and their formats where feasible.
Since this is only going to be relevant to support certain printers (if those printers start needing it) and we can't test with those printers, we're not likely going to be implementing this at Ultimaker. What's more, Ultimaker itself will not allow us time to implement this since they don't benefit from it either. So we'll have to defer this. It's not going to get any priority, though it would be nice to have (as long as it doesn't increase complexity of code maintenance too much).
So maybe consider pngdec and the png format?
-
@oliof my developers tell me that unfortunately .PNG format needs a 32K RAM buffer to decode it, because it uses LZW compression. That's why we can't use it for this purpose.
For example, the documentation of PNGDec for Arduino says it only works on processors with at least 49kb of RAM. Also, the PNGDec Arduino library is several thousand lines of C++, compared to 300 claimed for a QOI decoder.
-
@dc42 Here is a QOI and a PNG of the same Cura scene (=sliced model) rendered in 320x320 pixels generated by my Cura-DuetRRFPlugin:
snapshot.qoi.txt (just renamed to .txt for uploading here)
And here my changes to make it happen on the
next
branch: https://github.com/Kriechi/Cura-DuetRRFPlugin/tree/nextIt is not embedding anything yet into the gcode file (@dc42 did you settle on a file spec for that yet?), so instead it just creates a few files in your
~/Downloads/
folder.The plugin also logs extensively to the usual cura log file - in case you get an error, please attach it.
-
@resam thanks for that! What I would like is for the QOI thumbnail image to be base64-encoded and added to the GCode file as a specially formatted comment - just like PrusaSlicer/SuperSlicer do except that they start from PNG format. Both PNG and QOI have (different) magic bytes at the start of the file, so we can use them to check whether the format is QOI.
The SuperSlicer code that does the base64 encoding and writing to file is at line 921 of https://github.com/supermerill/SuperSlicer/blob/master/src/libslic3r/GCode.cpp.
PS - here is an example of thumbnail comment blocks generated by SuperSlicer (these are still encoded in PNG format). SuperSlicer puts it close to the start of the file, after the "generated by" comment.
; ; thumbnail begin 16x16 844 ; iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAACPklEQVR4AYVT32vTUBTOP6KFqaC+C2 ; Pbi/+CvyZ7moiPysA9CGotdqtx7di6pjRNm9r0l41Lmy5p2rWElrYECgGh4lOf8uZr/oNrvsCROSY+ ; XM65957zne/e8x2u3++rs9lMMQyjJcuyPRqNalf5w+Hwa7vd1uv1es+yrG+TyaSCXM627QYuVFU1YR ; H8Lx/JpmlqBA4QDodwHMf5Ah+VkHSVDwswxBIoR7RAFUCwT3ne+yTLjqZpnXK5POArldBH9fF4XEUM ; gLEPAXAAEBzuqOqPDUnyI/v77Fk6vUzk8856NutXLMvEmxFP1WFDAFwQvU1R9FayWbaWyfg7krRAla ; iuz9dOTnwUooVisCEAaBIy/EgiwW4KAlvP5fyHkuTdi8X8t8fH84/5/DyjqvZfANul0hKUN/b2/OeF ; whLJm7Wat3V66t3K5diDTMZrdDrmowBoNZXy76TT7LGm/XqlKD9fx+MLLmiu8eboyH2vKO4TQfBeiu ; JC63ZbW4WCd79a9VcODthqMul/7nan9V6vE+ohuE/p+tQ6P1c5QRCm+AOIA3a32fx+LRplt4Mn3Dg8 ; ZHdLJXY9HmfNszOduoRY/FnYRnwSDtEe+C+CJ6EDjVbLeJdKubvF4iLC8+yDKLpIGAwGTQBR6zlUxQ ; G1BhS3k8kl+byiOACE8i5LOdQBpAwkCAVgJF+agVix6PKiOCUpk2bAGLl/pEy0/jdM2GP4iA1H1InW ; RV1cHiaSOyWH00hVKREBtCfB0Mhf/CdYrN/5dKVwK+5qBwAAAABJRU5ErkJggg== ; thumbnail end ; ; ; thumbnail begin 220x124 12368 ; iVBORw0KGgoAAAANSUhEUgAAANwAAAB8CAYAAAACRt5vAAAkAUlEQVR4Ae2dSZdcxZXH32cAGzcaql ; RVGhASGGNxjt3GbYNtZhvMoEIWAolJQqiQSmgGyoAEEqZAwggQNni2z/HGvWs2vfI5XvVKW69q3av8 ...(lots more lines here) ... ; +5EYPU6Oqjuf08VWO1wzxcz7fJ63JSyppUeuqIGoq3czTCxqlRCxfeaPB5rkmpx1CCqabG2POYJRpD ; faHKYR6xbJDv87EbDDVoqkapM1bmlaQRQN345JMdGRLSHGxS6rHWsklNjSnZ8xoam9iFsS/Ldc98hP ; Gtj6SGJKEKSamsK00jPJcvJPyyHvVlhRxGTkjr0qEGjiqOyE31aj6TYUdOg/o08v+XlPmlxsnXiJ9L ; NPrWimseOIKy/g8uwR/l/+4AzAAAAABJRU5ErkJggg== ; thumbnail end ;
-
@dc42 Here the file beginning with a 320x320 QOI (about 37kB, so only the first few lines):
;FLAVOR:RepRap ;TIME:4199 ;Filament used: 3.57983m ;Layer height: 0.15 ;MINX:69.693 ;MINY:92.957 ;MINZ:0.2 ;MAXX:174.818 ;MAXY:152.057 ;MAXZ:7.55 ;POSTPROCESSED ;Generated with Cura_SteamEngine 4.12.1 ;Exported with Cura-DuetRRF by Thomas Kriechbaumer 1.2.5 ; thumbnail begin 320x320 37140 ; cW9pZgAAAUAAAAFABAAA/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f ; 39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39 ; /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f ; 39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39 ; /f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f ; 39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39/f39 ; /f39/f39/f39/f39/f39/f396P8aFQYa/4BnHYIA/f39/f3F/xoVBRr/06sw1/+DaiCnAP39/f39xP ; 8aFQYb/9auMNr/+so5//9xXBp7AP39/f39wz//06sw2P/6yzn/wP9hTxduAP39/f39wgoWKcH/OzAR ; bgD9/f39/cEK/9SsMNgpwv83LxdVAP39/f39wP85Lg06FinCnnn/EA4GNQD9/f39/f86Lw07/+y/Nf ; Apw//3yDj+/wQEBCkA/f39/fz/OzANPP/uwTbzKcT/5rs2+wD9/f39/P86Lw08AinF/8WhMfsA/f39 ; /fsQ/+/BNvMpxv+7mCzQAP39/f36EP/tvzXx//vLOf/H/450JMMA7/9CNQ9D/yoiCSv/AAAAAP39/f ; 3G/zwwDT09LMj/jHIisADs/wcFAQf/RTgPRv/AnCvE//nKOP7/IhwKRwD9/f39xf9HORBI/+3ANfEs ; yf9nVBqKAOr/AwIAA/9hThZj/9WtMNkpwP7bsjT/CAgFLgD9/f39xP9pVRdq//rKOP7/+8s5/8r/Vk ; cYigDo/xANAxD/c10adf/asDHeKcL+pYct/wICAQ4A/f39/cP/aFQXav/4yTj8LMv/RjkRWADm/w8M ; Aw//emMbfP/pvDXtLMT/b10k9v8BAQELAP39/f3C/2lVF2sS//vLOf/M/x4aC1EA5P8iHAcj/5Z5Ip ; n/6r017izFnXr/Ny8YwgD9/f3L/xcTBRj/Ix0IJADxEzEszf8cFwg5AOL/HxkHH/+ZfCKc//LEN/Ys ; ... snip ; thumbnail end T0 M190 S60 M104 S215 M109 S215 ...
Latest changes pushed to https://github.com/Kriechi/Cura-DuetRRFPlugin/tree/next
-
I'm working on getting this up and running in PrusaSlicer. It's not going smoothly so far but that is my fault. I'll keep trying and let you know if I give up.
-
Ok so I have what appears to be a working first version.
But, I have not figured out a way to verify that the encoded base64 is indeed the QOI image...
; generated by PrusaSlicer 2.4.0+n8 on 2022-01-02 at 07:14:16 UTC ; ; thumbnail begin 32x32 1332 ; cW9pZ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2NW/r9uQP7NcDzK/r5tP/50XVA/wCwVEaiIQDuZiFXAEqKIChk/MP5lWVL+ ; kWNJ/s1wO8j+r2pCP8AOCjcdMCwRCQMOP8AZHRLAIcH+k2RKKcb+kWJIPxnAfxk/MCHAMDeTiCE3FT ; ADwBLBIaeI/n9zbP7Ec0Qpwv6+bD7+cltOITAKAjcwIcISIRIsHT8wA8ISKLmIAf5pXVb+kmRJKcD+ ; kGFHIcA/ChkwwSESwSEOo4ghnIjAf8ADNDCxiLSILxIDwP5iV1D+c1tOEsAOGR0SwiE/EjAdLAAAAA ; AAAAAB ; thumbnail end ; ;
https://github.com/n8bot/PrusaSlicer/commit/e087f3bf78d6822d36900bcd53b0a0df6d00b24d
-
Well, I was able to confirm that I can generate and output a QOI image to a file from prusaslicer. and I can confirm that when that file is converted to base64 encoding, the outputted string to gcode is identical. So, indirectly I confirm that the implementation works.
However, there still might be issues. It's a start.
Now, I have to integrated it only when RRF is selected.
-
The test image file seems to be upside down when I view it in this viewer I got from some random GH repo. I have done nothing that seems like it would influence the upside-downness of the image, so I think that might just be a problem with the image viewer. In any case, it would be easy to flip the image if needed.
-
@bot I think my first try also had it flipped in Y. The PNG encoder used in PrusaSlicer has a
flip
parameter that was active, so I'm pretty sure that QOI just expects its pixel data the other way around.From your base64 sample posted above, unfortunately I have to report that the
qoiconv
tool just produces visual gibberish when converting to PNG. -
@resam did you decode it from base64 first?
-
@bot of course! It seems to be valid QOI with 32x32 pixels, just that the color data doesn't resemble a meaning 3D model... unless that is intended for your test?
-
@resam Hmmm no that is not intended at all. But actually that output was from an older test. Can you try this?
; generated by PrusaSlicer 2.4.0+n8 on 2022-01-02 at 08:52:13 UTC ; ; QOI thumbnail begin 64x64 1496 ; cW9pZgAAAEAAAABABAAAwv9QUFB//6Ghof//jY2N3yUA7v88PDxg/6Ghof8Y/ygoKEAAx/8UFBQg/3 ; l5eb8kJQDT/xkNByD/lFErv/+SUCrf/xULBiD/AAAAANL/FBQUIP95eXm/JAz/FB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DxgAMIQMsE6IzXmCSsGwQEAwiX/oaGh/wwAwxAywKKXNekJGwbAAQDD/xQUFCAAxBA6IzXsCSsB ; AMr/r2Az3zXvCf+lWzDfAMr/Gg4HIP+zYzTfNe4J/zMcD0AAyyX/ZjgefzXs/4BHJZ8Azw4JNegJDg ; DRJRE15v+aVS2/ANURNeQRANclCTXgCQ4A2SURNd4RAN0lCTXaCQ4A3yURNdgnAOMRNdYRAOUlJzXS ; CSUA5yURNdARAOslCTXMCQ4A7SURNco7APH/TSoWYDXHCQ4A8yU7NcQnAPcRNcIRAPklCcAOAPslAN ; 4AAAAAAAAAAQ== ; thumbnail end ; ;
-
@bot that one is producing a completely empty 32x32 PNG...
I have to mention though: I don't fully trust the QOI toolchain either
But the converter tool is from the "official" specification repo, so -
@resam I tend to believe what you are verifying. I've not been able to decode the base64 into what is a viewable QOI image... however, the file writing to qoi format works.
Hmmm.. Thank you for the help. I have no idea what to try now lol.