Does anyone here work on Superslicer?
-
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 PrusaSlic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LKDDXVCRsGygEAyRj/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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d8lANElJBgzMtGi ; lzX7CRsG0Q0YJCUAzv8UFBQgGCQlADMyzzojNf3AKSsGzwEMJSQY/ygoKEAAyyUk/42Njd//KCgoQA ; DAMzLOBDX9wwkbBs4BAMAM/42Njd/AJQDIDP95eXm/JP9lZWWf/wAAAADCMzLNopc1/cYbBs0BAMH/ ; FBQUICUkGAwAxf88PDxg/6Ghof8Y/ygoKEAAwzMyyzotNf3ICQ8GywEAwyUk/42Njd8lAMIM/3l5eb ; 8kDADFMzLKopc1/csJGwbKAQDE/xQUFCD/eXl5vyT/ZWVln/8AAAAAwP8oKChAJMAlAMYzMsg6IzX9 ; zgkrBsgBAMX/FBQUICUk/42Njd//KCgoQCT/jY2N3/8oKChAAMczMseilzX90QkbBscBAMf/FBQUIP ; +NjY3fJCUAyTMyxTojNf3UmCsGxgH/AAAAAMgMJQDKMzLEBDX91wkPBsQBANYzMsOilzX92QkbBsMB ; ANYzMsE6IzX93AkrBsEBANYzMsAMNf3fCRsGwAEA1jM6IzX94ikrAQDW/5ZSK781/eUJ/3dBIp8A1v ; 8aDgcg/2Y4Hn81/eT/mlUtvwDZETX94hEA2yX/s2M03zX93gn/MxwPQADdJRE1/dwRAOElCTX92AkO ; AOMlETX91icA5xE1/dQRAOklJzX90AklAOslETX9zhEA7yUJNf3KCQ4A8SURNf3I/4BHJZ8A9f9NKh ; ZgNf3FCQ4A9yUnNf3CJwD7ETX9wBEA/SUJNfoJDgD9wSURNfgRAP3FDgk19AkOAP3HJRE18icA/csR ; NfARAP3NJQk17AklAP3PJRE16hEA/dMlCTXmCQ4A/dUlETXkJwD92RE14QkzAP3bJSc13iclAP3dJR ; E13BEA/eElCTXYCQ4A/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
-
@dc42 now that we have shown this is feasible, a few more questions:
- one image in a fixed resolution, or multiple: 32x32 + 64x64 + 128x128, ...?
- square or same aspect ratios as the PanelDue: 1.6666 and 1.7647?
- what about DWC? use the same embedded QOI, or upload a dedicated PNG next to the gcode file?
From the wiki I got these for PanelDue: 480×272 (4.3" displays) or 800×480 pixels (5" and 7" displays).
-
@resam @bot I suggest that for DWC we use QOI again. We may wish to support PNG in DWC too, however the headers for PNG and QOI encoding will allow DWC to identify which decoder to use.
I'll liaise with @chrishamm on what default thumbnail resolutions would suit both RRF and DWC. I presume you can pick up the required resolutions form the .ini file as is the case for PNG thumbnails. Maybe we should add an option to the Superslicer .ini file to specify the thumbnail image format?
-
@dc42 Correct, the thumbnail resolutions are taken from the ini file, which is generated by the GUI.
If multiple resolutions are input, multiple thumbnails will be output to the gcode file. I assume the files do not need to conform to any aspect ratio, but I've only tested square power-of-2 sizes in width and height (just our of habit, I guess).
It would be possible to allow the user to select the format, but I know for sure that PrusaSlicer upstream will be reluctant to include changes to the GUI settings. Quietly choosing a new format for RRF will be more inline with their wishes, I imagine.
For SuperSlicer, @merill will decide what to do.
I have uploaded a universal macOS release that should work on intel and M1 macs alike, to broaden your potential testing base for this. Found here: https://github.com/n8bot/PrusaSlicer/releases/download/version_2.4.0-release1-n8/PrusaSlicer-n8-2.4.0-release1-macOS.dmg
Let me know if you'd like any changes.