Does anyone here work on Superslicer?
-
@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 ; cW9pZgAAACAAAAAgBAD+WVlZrIj+kJCQsYj+eHh4hYidiMB/wSiuiKeIIP53YFOb1QrBO8CliKSIKD ; ssVcOsiLiImohAs4iSiIeICsGjiBHAQP6UZ07+xmw5/qdcMP6BW0UKwCgzwJqIO8Aswwr+fn5+iogZ ; CiAXp4gNGRUgFf5qXlj+q2hCMsAGwP6dXDX+aF9ZERUZCjvBLMA7pIijiBU7wArAFQG1iDkNN/6RZE ; sywgbB/p9dN/6DXUcZCsI7wBmliBU7KDvACsEkAR7+iH13/q1qQzLDBsP+lFw7/mVcVv5bW1vBGaOI ; AjcswLeIMwrAGTMgFf58Zlkyxf6nXDDE/p5cNf6BXEYZKDMCGTvALCAFmYgVETM3/pFkSjLGBsYAER ; UKwDvBCiSxiD2OiDH+uWo9MscGx/6eXDb+ZVtWCsA7wRkzIDr+nG9VMskGyA7+gVtFCsA7GQKciBn+ ; q2hBMsr+p1wwyHrADhmjiAIZOwodMsr+p1wwyAnAFRECGTvBHTLKBscJwf6hXzn+bm5uNzvC/rhqPT ; LKBscJwf6gXjgkwDcsChkaMsmhmJkbBsUJwhUKKKOILAqoiP66bD8yyKKXo5fAGwbECcFr/p5cNgo7 ; GTumiKKI/rlqPjLGfqOoNcKdaf6wYTMGwnrBEP6eXDY7wKaIf0A7GjLFDDXFnWkb/qdcMMB6wRDA/p ; 5cNhmriDkKLMAaMsM6o5c1yJ1p/qxfMZ16wRDAFf5zc3OsiC+SiMH+uGk9/sZsOcIMNcudaRuWDMAQ ; wP6lYj3+lJSUESxAwB0VMsA6IzXOmCsQwf6lYz3+fX19p4iDiA7BFTIENdGdapYMmCz+nlw2KLOItY ; j+VlZWCsAaDDXUGxUdLCCQiCwC/qZsTDXW/qFoRh3ALMA3nYj+Z1tU/pNlSjXOZsT+lGZMDsA7pogo ; DkDB/mVZU/6/bkA1wWbN/r5tP/6Bal3+bW1tkogZJAqZiMJ/wP5nXFX+mGlP/s1wPM7+oWdGDiwvr4 ; iXiDs/nYjCIX8sp4j+e2NW/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/FBQUIADJDCUk/42N ; jd//KCgoQADQ/2M2HH//xmw5/8D+p1wwAf9TLhh/ANAYJMAlAM0M/42Njd/AJQDNHTMywQbBAf8VCw ; Yg/wAAAADNJSQY/ygoKEAAzwwlJP+NjY3fDADK/zEbDkAywwbCAf9TLhh/AMoM/3l5eb8k/2VlZZ// ; AAAAANP/KCgoQP+NjY3fwCUAyDAyxAbEPADIJSQY/ygoKEAA1f8UFBQgJST/eXl5v/8UFBQgAMQd/6 ; 1eMt8yxQbFAf8qFwxAAMQM/3l5eb8kDADZJST/jY2N3yUAwjAyxwbGATwAwv8oKChAJMAlANv/FBQU ; IP+NjY3fJCUAHTMyyAbIAf8VCwYg/wAAAAAlJBj/KCgoQADdDCUk/5t5Zt8yygbJAf6QalQkJQDgHT ; MyywbL/3xOMr8A4P8xGw5AMs0GzAH/PyISYADdMDLOBs7/Uy4YfwDaHTMyzwbPAf8VCwYg/wAAAADX ; MDLRBtABPADUHTMy0gbS/31FJL//FQsGIP8AAAAA0f8xGw5AMtQG0/+SUCrf/1MuGH8AzzAy1QbVPA ; DMHRAy1gbWAf8VCwYg/wAAAADKEDLXBtcBAMoQMtcG1wEAyhAy1wbXAQDKEDLXBtcBAMoQMtcG1wEA ; yhAy1wbXAQDKEDLXBtcBAMoQMtZ+/qxfMQbWAQDKEDLVoZiklp1pmCwG1QEAyhAy1KKXNcIbBtQBAM ; oQMtI6o6g1xAkrBtIBAMoQMtEMNccJGwbRAQDKEDLPOqOXNcoJKwbPAQDKEDLOBDXNCRsGzgEAyhAy ; zDqimDXQlQ0GzQEAyhAyywQtNdIJ/rBhMwbLAQDKEDLKDDXVCRsGygEAyRj/wXNG/zLIOiM12AkrBs ; gBJQDHJSQhMscMNdsJGwbH/qZlPiQlAMT/FBQUIP+NjY3fJCUQMsU6IzXemzorBsUSJSQYDADBJSQY ; /ygoKEAAEDLEBDXhCRsGxAEADP+NjY3fwCUA/3l5eb8kDADBEDLDopc15BsGwwEAwP8UFBQgJSQYJP ; 88PDxgAMIQMsE6IzXmCSsGwQEAwiX/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.
-
@bot does PrusaSlicer give you RGBA data with 4 channels? or just 3?
you seem to have it hardcoded to 4, but I don't see where you take this assumption from. -
@resam The image data is 4 channel, yes. The PNG contains full transparency in part of it.
When I write a test QOI image from a thumbnail, the image is perfectly vieable in https://github.com/Tom94/tev
So, the problem doesn't seem to be the pixels. It seems to be the base64 encoding?
But also the last test might have been ruined by me trying to generate QOI only if RRF is selected.
-
I have verified that everything works as intended, albeit the thumbnail is upside down! lol. Not sure why that is.
The branch has been updated to trigger QOI format only if RRF is selected as gcode flavor. Also, the thumbnail comment will indicate if it is QOI (but will remain unchanged if outputting PNG)
https://github.com/n8bot/PrusaSlicer/tree/n8-240-qoitest
; generated by PrusaSlicer 2.4.0+n8 on 2022-01-02 at 09:00:33 UTC ; ; QOI thumbnail begin 128x128 3024 ; cW9pZgAAAIAAAACABAAAx/8UFBQg/42Njd//oaGh//9QUFB/AP3mJSQY/ygoKEAA0QwlJP+NjY3fDA ; Du/xkNByCeaf8AAAAA7gz/eXl5vyQlANX/FBQUIBjAJQDs/0ooFWD/xmw5//+SUCrf/1MuGH8A7CUk ; GP8oKChAANcMJST/jY2N3wwA6B3/lFErvzLA/qdcMMD/aDkenwDpDP95eXm/JAwA2yUkGCUA5v8xGw ; 5AMsIGwQH/PyISYADm/ygoKEAkwCUA3f8UFBQg/3l5eb8kJQDk/2M2HH8ywwbD/1MuGH8A5CUk/42N ; jd//FBQUIADfDCUkGP8oKChAAOAdMzLEBsQB/xULBiD/AAAAAOAM/42Njd8kJQDjDBjAJQDeMDLGBs ; UBPADeJSQY/ygoKEAA5QwlJP+NjY3fDADaHTMyxwbH/31FJL//FQsGIP8AAAAA2gz/eXl5vyT/ZWVl ; n/8AAAAA6f88PDxg/6Ghof8YJQDY/zEbDkAyyQbI/5JQKt//Uy4YfwDY/zw8PGD/oaGh/xj/KCgoQA ; Dr/xQUFCD/eXl5vyT/ZWVln/8AAAAA1jAyygbKPADV/xQUFCD/eXl5vyQMAO7/FBQUICUk/42Njd// ; PDw8YADSHf+tXjLfMssGywH/FQsGIP8AAAAA0v8oKChA/6Ghof/AJQDxDP+NjY3fJCUA0DAyzQbMAT ; wA0CUkGP8oKChAAPMMJST/jY2N3wwAzB0zMs4GzgH/FQsGIP8AAAAAzAz/eXl5vyQlAPf/KCgoQP+N ; jY3fwCUAyhky0AbPATwAyiUkGP8oKChA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Q4A/eMlETXWOwD95w4JNdIJDgD96SURNdAnAP3tETXOEQD97yUJNcoJDgD98SUR ; NcgRAP31JQk1xAkOAP33JRE1wicA/fsRNcARAP39JcAA/f39wwAAAAAAAAAB ; thumbnail end
results in
-
as @resam pointed out to me, PrusaSlicer itself has to flip its pixels while encoding to PNG. I tried reversing the vector of pixels using std::reverse but that is not working.
So... for now the thumbnails are upside down! Lol. Sorry dc42.
@dc42 Here is a build of PrusaSlicer-n8 2.4.0 with the QOI image format enabled for RRF firmware, and upside-down thumbnail generation.
I've created an issue with QOI GH repo to ask/mention the idea of a flip image function on encode, so we can easily get our thumbnails the right way around!
Link to Win64 binary release: https://github.com/n8bot/PrusaSlicer/releases/download/version_2.4.0-release1-n8/PrusaSlicer-n8-2.4.0-QOIforRRFtest1-Win64.zip
-
@bot wow that was quick, I didn't expect anything so soon! Thanks!
Are the pixels encoded in the file top-to-bottom, or bottom-to-top? And within each row are they left-to-right?
-
@dc42 According to the spec, they are encoded
/* Images are encoded row by row, left to right, top to bottom. The decoder and encoder start with {r: 0, g: 0, b: 0, a: 255} as the previous pixel value. An image is complete when all pixels specified by width * height have been covered. Pixels are encoded as - a run of the previous pixel - an index into an array of previously seen pixels - a difference to the previous pixel value in r,g,b - full r,g,b or r,g,b,a values */
It surprised me how fast it was, too! The library was basically a drop-in replacement with the PNG library.
I'm experimenting with ways to flip the pixels vertically before they are encoded to QOI, but it's proving difficult because of some weird pointer stuff. I suppose they appear upside down because of the way PrusaSlicer collects the pixel data into vectors. The PNG miniz library has a bool flag on the encode function to flip the pixels vertically.
[Edit: I was able to reverse the vector of pixels, which does flip the image vertically but it also seems to invert the colour or swap the channels around incorrectly. Further experimentation required.]
-
Ok, I'm done!
Image is now flipped vertically, and the colours render correctly:
https://github.com/n8bot/PrusaSlicer/commit/821cbee27ce0a04d4dd86a9ce01a4fa271167236
Updated Win64 binaries: https://github.com/n8bot/PrusaSlicer/releases/download/version_2.4.0-release1-n8/PrusaSlicer-n8-2.4.0-QOIforRRFtest2-Win64.zip
Here are some web-based tools for testing:
Covnert Base64 to binary or hex: https://cryptii.com/pipes/base64-to-binary
Copy and Paste Hex data and save as file: https://hexed.it/
Drag and Drop saved QOI image viewer: https://floooh.github.io/qoiview/qoiview.html