Using the Prusa Slicer command line tool to generate gcodes with image previews
 
Notifications
Clear all

Using the Prusa Slicer command line tool to generate gcodes with image previews  

  RSS
Logicon
(@logicon)
New Member
Using the Prusa Slicer command line tool to generate gcodes with image previews

Hey there. I recently set up a script to batch process a bunch of .stl files for me to print. However I noticed that the gcodes it generates has no image preview when I view the file on my printer. The filenames alone aren't enough for me to verify the file (sometimes the file names are too long and it won't even show the whole thing) so preview images are pretty important for me to know I picked the right file.

Is there a way I can get these gcodes to be generated with an embedded image? From my research it looks like the command line tool needs to take a screenshot to get the image and there's no internal parameter that will work here.

Does anyone know of any alternative tools that can generate an image from a gcode and possibly embed that image within the gcode file itself?

Posted : 04/04/2023 7:37 pm
Spug_Yeti liked
Spug_Yeti
(@spug_yeti)
New Member
RE: Using the Prusa Slicer command line tool to generate gcodes with image previews

I too am disappointed this is not a feature of prusa-slicer-console (for the very same reason). It would be very nice to have gcode generated from my batch script have preview images. 

Posted : 10/11/2024 1:43 am
Diem
 Diem
(@diem)
Illustrious Member

The simple workaround is to make sure the filenames are meaningful.

Open an ASCII mode g-code file and you will see the thumbnail inclusion format, they are QOI encoded.  It should be trivial to post process the inclusion of any desired QOI into the output.

Cheerio,

Posted : 10/11/2024 6:31 am
Spug_Yeti liked
Spug_Yeti
(@spug_yeti)
New Member
RE: Using the Prusa Slicer command line tool to generate gcodes with image previews

Thanks for the info! It took me a minute to understand what you were referring to by "ASCII mode g-code" which I now understand to be any human-readable gcode file (eg. NOT bgcode).

Do you know a good solution for post-processing thumbnails into binary g-code using the CLI?  I have a PowerShell script which batch slicing my 3mf files into bgcode. Maybe I could export as g-code, inject thumnail info, then convert to bgcode? I'm aware Prusa slicer can convert between the two formats, but I don't see an obvious argument to do so in the prusa-slicer-console documentation (I want to avoid any user interaction).  

Posted : 10/11/2024 4:41 pm
Neophyl
(@neophyl)
Illustrious Member
RE: Using the Prusa Slicer command line tool to generate gcodes with image previews

I don't think it matters , as far as I'm aware, running the command line version of PS will not give ANY sort of thumbnail as it relies on the GUI to generate the image, regardless of its encoding.  

Theres at least one issue on the PS github regarding this already https://github.com/prusa3d/PrusaSlicer/issues/7878   

This comment in that thread https://github.com/prusa3d/PrusaSlicer/issues/7878#issuecomment-1916975897   might have a solution (haven't tried it myself)

Posted : 10/11/2024 4:48 pm
ssmith and Spug_Yeti liked
_KaszpiR_
(@_kaszpir_)
Prominent Member
RE: Using the Prusa Slicer command line tool to generate gcodes with image previews

Afair the comment does not have a solution, the code is not publicly available.

What you could try is to look at this tool I forked some time ago which can be used for some preview generator  https://github.com/nvtkaszpir/gcode2png but notice some previews are just ugly as I do not intend to try to spare more time over this project to improve rendering.

Look at the project tags on the GitHub, you may find other related tools.

See my GitHub and printables.com for some 3d stuff that you may like.

Posted : 10/11/2024 5:31 pm
ssmith liked
Share: