Skip to content

Gcode preview

ThomasToka edited this page Jan 16, 2026 · 104 revisions

As of v008 E3S1PROFORKBYTT supports gcode preview with 250 x 250 px.

As of v023 E3S1PROFORKBYTT print data is shown on the mainsite if a new preview printdata script is used.

Gcode preview is only possible if you print from SD up to v023. As of v024 its can be shown on the display with the OctoPrint-E3S1PROFORKBYTT_Thumbnails plugin which was released with it. The Plugin is here: https://github.com/ThomasToka/MarlinFirmware/wiki/OctoPrint%E2%80%90E3S1PROFORKBYTT_Thumbnails-plugin

This is how you make the gcode preview work in your slicer so it is persistant in your generated gcode files:

Prusaslicer:

  • "YOURUSER" is a placeholder for your real Windows User in the following. Change it to your user.

  • install python 3 over the Windows App Store or in case of an other OS with your favorite method

  • install Pillow in your administrative cmd or shell with "pip install Pillow"

grafik

grafik

  • under Print Settings -> Output settings set the following:

grafik

  • additionally you need to add (or check if its present) a ;AFTER_LAYER_CHANGE entry to the Printer Settings -> Custom G-Code:
;AFTER_LAYER_CHANGE
;[layer_z]

grafik

Example for copy and paste (change accordingly for your user and python3.exe folder):

Windows:

"C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe" "C:\Users\YOURUSER\AppData\Roaming\PrusaSlicer\scripts\E3S1PROFORKBYTT_printdata_prusaslicer_v27_thumbnail.py"

Mac (the tilde is important!):

python3 ~/Desktop/E3S1PROFORKBYTT_printdata_prusaslicer_v27_thumbnail.py

Sometimes Prusa makes the image for the thumbnail too big, file byte size. To help with this you can use a 1x1 pixel image to remove the background bed, which decreases the size of the generated thumbnail by a substantial amount. You can get this 1x1 pixel image here: https://github.com/ThomasToka/MarlinFirmware/blob/553a54ae4e9c2e1b01a47d55a67426968901d2f7/bed.png See below on how to set the image in Prusa.

image

Cura 5.x:

grafik

Example for copy and paste (change accordingly for your user and folder):

"C:\Users\YOURUSER\AppData\Roaming\cura\5.7\scripts\E3S1PROFORKBYTT_printdata_cura_v5_thumbnail.py"

Creality Slicer 4.8.x

grafik

  • change density if needed for your filament

grafik

There is no M73 script needed. Its already inbuild and can be activated on demand over the displays M73 button.

Orca Slicer:

  • "YOURUSER" is a placeholder for your real Windows User in the following. Change it to your user.

  • install python 3 over the Windows App Store or like in case of an other OS with your favorite method

  • install Pillow in your administrative cmd or shell with "pip install Pillow"

grafik

  • download the gcode manipulation script and put it in "C:\Users\YOURUSER\AppData\Roaming\OrcaSlicer\user\default\process"

  • under Printer Settings -> Basic information -> Advanced set the following:

Orca Slicer v1.8:

grafik

Orca Slicer v1.9:

grafik

Orca Slicer v.2.x:

grafik

Additionally you need to add a ;AFTER_LAYER_CHANGE entry to the Machine G-Code:

;AFTER_LAYER_CHANGE
;[layer_z]

grafik

  • under Preview -> Others set the postprocessing script:

grafik

Example for copy and paste (change accordingly for your user, python3.exe folder and OrcaSlicer version):

Windows:

"C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe" "C:\Users\YOURUSER\AppData\Roaming\OrcaSlicer\user\default\process\E3S1PROFORKBYTT_printdata_orcaslicer_v19_thumbnail.py"

Mac (the tilde is important!):

python3 ~/Desktop/E3S1PROFORKBYTT_printdata_orcaslicer_v19_thumbnail.py

Super Slicer:

  • "YOURUSER" is a placeholder for your real Windows User in the following. Change it to your user.

  • install python 3 over the Windows App Store

  • install Pillow in your administrative cmd or shell with "pip install Pillow"

grafik

grafik

  • under Printer Settings -> General -> Thumbnail set the following:

grafik

  • under Print-Settings -> Output Options -> Post-processing script set the postprocessing script:

grafik

Example for copy and paste (change accordingly for your user and python3.exe folder):

"C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe" "C:\Users\YOURUSER\AppData\Roaming\SuperSlicer\E3S1PROFORKBYTT_printdata_superslicer_thumbnail.py"

Creality Print 6.3

  • "YOURUSER" is a placeholder for your real Windows User in the following. Change it to your user.

  • install python 3 over the Windows App Store or like in case of an other OS with your favorite method

  • install Pillow in your administrative cmd or shell with "pip install Pillow"

grafik

  • download the gcode manipulation script and put it in "C:\Users\YOURUSER\AppData\Roaming\Creality\Creality Print\6.0\user\default\process"

Additionally you need to add a ;AFTER_LAYER_CHANGE entry to the Machine G-Code:

;AFTER_LAYER_CHANGE
;[layer_z]
grafik
  • under Global set the postprocessing script:
grafik

"C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe" "C:\Users\YOURUSER\AppData\Roaming\Creality\Creality Print\6.0\user\default\process\E3S1PROFORKBYTT_printdata_creality_print_6_thumbnail.py";

Example for copy and paste (change accordingly for your user, python3.exe folder and OrcaSlicer version):

Windows:

"C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe" "C:\Users\YOURUSER\AppData\Roaming\Creality\Creality Print\6.0\user\default\process\E3S1PROFORKBYTT_printdata_creality_print_6_thumbnail.py";

Mac (the tilde is important!):

python3 ~/Desktop/E3S1PROFORKBYTT_printdata_creality_print_6_thumbnail.py

Creality Print 7.x

  • "YOURUSER" is a placeholder for your real Windows User in the following. Change it to your user.

  • install python 3 over the Windows App Store or like in case of an other OS with your favorite method

  • install Pillow in your administrative cmd or shell with "pip install Pillow"

grafik

  • download the gcode manipulation script and put it in "C:\Users\YOURUSER\AppData\Roaming\Creality\Creality Print\7.0\user\default\process"

Additionally you need to add a ;AFTER_LAYER_CHANGE entry to the Machine G-Code:

;AFTER_LAYER_CHANGE
;[layer_z]
grafik
  • under Global set the postprocessing script:
grafik

"C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe" "C:\Users\YOURUSER\AppData\Roaming\Creality\Creality Print\7.0\user\default\process\E3S1PROFORKBYTT_printdata_creality_print_7_thumbnail.py";

Example for copy and paste (change accordingly for your user, python3.exe folder and OrcaSlicer version):

Windows:

"C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe" "C:\Users\YOURUSER\AppData\Roaming\Creality\Creality Print\7.0\user\default\process\E3S1PROFORKBYTT_printdata_creality_print_7_thumbnail.py";

Mac (the tilde is important!):

python3 ~/Desktop/E3S1PROFORKBYTT_printdata_creality_print_7_thumbnail.py

Bambu Studio 2.4

Important: Bambu Studio uses a 50px x 50px thumbnail that i have to scale up to 250px x 250px to fit on our display. So the generated thumbnail will by design be blurry for now. If Bambu Studio devs add a possiblity to set the size like orca does i will adjust this script.

  • "YOURUSER" is a placeholder for your real Windows User in the following. Change it to your user.

  • install python 3 over the Windows App Store or like in case of an other OS with your favorite method

  • install Pillow in your administrative cmd or shell with "pip install Pillow"

grafik

  • download the gcode manipulation script and put it in "C:\Users\YOURUSER\AppData\Roaming\BambuStudio\user\default\process"

  • additionally you need to add a ;AFTER_LAYER_CHANGE entry to the Machine G-Code:

;AFTER_LAYER_CHANGE
;[layer_z]
bambu_studio_1
  • under Global set the postprocessing script:
bambu_studio_2

"C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe" "C:\Users\YOURUSER\AppData\Roaming\BambuStudio\user\default\process\E3S1PROFORKBYTT_printdata_bambustudio_thumbnail.py";

Example for copy and paste (change accordingly for your user, python3.exe folder and OrcaSlicer version):

Windows:

"C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe" "C:\Users\YOURUSER\AppData\Roaming\BambuStudio\user\default\process\E3S1PROFORKBYTT_printdata_bambustudio_thumbnail.py";

Mac (the tilde is important!):

python3 ~/Desktop/E3S1PROFORKBYTT_printdata_bambustudio_thumbnail.py

Appendix 1: Findings i made during the development:

added 11. November 2023:

i shed some light on the address space of the gcode preview function.

first: the address space for "display overlays" is 120KB for a single or all of those icons. we use only one of this kind -the gcode preview- picture so we would have theoretically 120KB (120000bytes) creality placed this icon on address 0xB000. right at the end of the space. here a little visualisation is handy:

our address space is 0x0000 to 0xFFFF

0x0000   0x40C6   0x6003   0x7000   0xA000   0xB000             0xFFFF
|-------|-------|--------|--------|--------|--------------------|
        ~7.81KB    ~4.0KB   12.0KB   4.0KB           ~20.0KB

second: creality did not add any check in their class to check the preview image size. this leads to the situation that too big preview images overflow the display. by design the display then overwrites this bytes from the beginn so from 0x0000.. this leads to overwriting used addresses what we have seen on some users display after for example loading a falsely generated png image from prusa slicer

third: i will move the gcode display icon to address 0xA000 adding 4KB more space for it

fourth: i added a "load check" for the gcode preview image with a size of 24500 (we could 24575 bytes exactly. but a little headroom is always good) bytes. with address 0XB000 20479 bytes were possible.. bigger preview images will simply not be loaded and the default icon appears.

we have this "myth" then also catched with concrete numbers and a definition of what happens and why

Appendix 2: Debugging steps in case of failures.

Please first check if your pip is up to date and Pillow is installed for your python3.exe.

This is a example for the windows store version. You should do this with your used python3.exe. YOURUSER is a placeholder for your Windows User.

C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe -m pip install --upgrade pip
C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe -m pip install Pillow
C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe -m pip install --upgrade Pillow

Under MacOS you can use this also but directly on the bin like:

python3 -m pip install --upgrade pip
python3 -m pip install Pillow
python3 -m pip install --upgrade Pillow

The scripts -not the cura script- are also runnable directly with python3.exe to see the real error output.

  • generate a gcode setting like shown in those two pictures in your slicer without setting a postprocessing script.

  • export the gcode to the same folder where your printdata script is named test.gcode for simlicity in case of PrusaSlicer: C:\Users\YOURUSER\AppData\Roaming\PrusaSlicer\scripts in case of OrcaSlicer: C:\Users\YOURUSER\AppData\Roaming\OrcaSlicer\user\default\process

  • open cmd with administrative rights and navigate to the folder cd C:\Users\YOURUSER\AppData\Roaming\PrusaSlicer\scripts or cd C:\Users\YOURUSER\AppData\Roaming\OrcaSlicer\user\default\process

  • execute the preview script with python pointing to the test.gcode

C:\Users\YOURUSER\AppData\Roaming\PrusaSlicer\scripts>python3.exe E3S1PROFORKBYTT_printdata_prusaslicer_v27_thumbnail.py test.gcode
Added 240 M117 commands.

or

C:\Users\YOURUSER\AppData\Roaming\OrcaSlicer\user\default\process>python3.exe E3S1PROFORKBYTT_orcaslicer_v20_thumbnail.py test.gcode
Added 241 M117 commands.

show me the result.

Orcaslicer:

grafik

Prusaslicer:

grafik

Appendix 3: Gcode preview with Octoprint

I have forked and adjusted the Prusa Slicer Thumbnail plugin to support all our fileformats with Octoprint:

grafik

The Plugin is located here:

https://github.com/ThomasToka/MarlinFirmware/blob/Firmware-Binaries/OctoPrint-E3S1PROFORKBYTT_Thumbnails.zip

  • install the plugin
  • go to the plugin
  • scan your folder for thumbnails.
  • enjoy thumbnails in octoprint

Appendix 4: Dacai displays

The dacai displays need once a update with crealities "private" folder of the 2.0.8.28 firmware. Including the firmware.zlib file in the root directory of the screen micro sd card. Instructions are:

With this release it is mandatory for dacai users to update once to the creality release 28 cause the delivered firmware.zlib file needs to be installed in order to support gcode preview. With this also the sound toggle will be activated. So a fair deal to do it once.

I have uploaded the file here: https://github.com/ThomasToka/MarlinFirmware/blob/Firmware-Binaries/Ender-3S1_Pro_HWv24S1_301_SWV2.0.8.28F4_F401_FDM_LASER.zip

Update the screen once (do not forget the firmware.zlib in the root of your sd card, it is important), then proceed with my firmware.

Appendix 5: macOS

Postprocessing for orca and prusa slicer is entered like this:

python3 ~/Desktop/E3S1PROFORKBYTT_printdata_orcaslicer_v19_thumbnail.py

Appendix 6: Using python3.13 on Windows.

Basics:

  • Windows defaults always to the smallerst installed python version.
C:\Users\YOURUSER>python3.exe
Python 3.12.11 (main, Jun  7 2025, 12:31:44)  [GCC 15.1.0 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>exit()
C:\Users\YOURUSER

C:\Users\YOURUSER>where python3.exe
C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.exe
  • you can trigger other windows store versions with their version number
C:\Users\YOURUSER>where python3.13.exe
C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.13.exe

C:\Users\YOURUSER>python3.13.exe
Python 3.13.9 (tags/v3.13.9:8183fa5, Oct 14 2025, 14:09:13) [MSC v.1944 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()

C:\Users\YOURUSER>

Updating pip for python3.13.exe and the matching Pillow:

C:\Users\YOURUSER>python3.13 -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in c:\program files\windowsapps\pythonsoftwarefoundation.python.3.13_3.13.2544.0_x64__qbz5n2kfra8p0\lib\site-packages (25.2)
Collecting pip
  Downloading pip-25.3-py3-none-any.whl.metadata (4.7 kB)
Downloading pip-25.3-py3-none-any.whl (1.8 MB)
   ---------------------------------------- 1.8/1.8 MB 10.5 MB/s  0:00:00
Installing collected packages: pip
  WARNING: The scripts pip.exe, pip3.13.exe and pip3.exe are installed in 'C:\Users\YOURUSER\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-25.3

[notice] A new release of pip is available: 25.2 -> 25.3
[notice] To update, run: C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\python.exe -m pip install --upgrade pip

C:\Users\YOURUSER>python3.13 -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: pip in c:\users\YOURUSER\appdata\local\packages\pythonsoftwarefoundation.python.3.13_qbz5n2kfra8p0\localcache\local-packages\python313\site-packages (25.3)

C:\Users\YOURUSER>python3.13 -m pip install Pillow
Defaulting to user installation because normal site-packages is not writeable
Collecting Pillow
  Downloading pillow-12.0.0-cp313-cp313-win_amd64.whl.metadata (9.0 kB)
Downloading pillow-12.0.0-cp313-cp313-win_amd64.whl (7.0 MB)
   ---------------------------------------- 7.0/7.0 MB 5.9 MB/s  0:00:01
Installing collected packages: Pillow
Successfully installed Pillow-12.0.0

C:\Users\YOURUSER>python3.13 -m pip install --upgrade Pillow
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: Pillow in c:\users\YOURUSER\appdata\local\packages\pythonsoftwarefoundation.python.3.13_qbz5n2kfra8p0\localcache\local-packages\python313\site-packages (12.0.0)
  • after this you can use this python version in your slicer like:
"C:\Users\YOURUSER\AppData\Local\Microsoft\WindowsApps\python3.13.exe" "C:\Users\YOURUSER\AppData\Roaming\OrcaSlicer\user\default\process\E3S1PROFORKBYTT_printdata_orcaslicer_v20_thumbnail.py";

Additionally i tested the python 3.14 release from the python page. Works the same without errors:

C:\Users\YOURUSER>C:\Users\YOURUSER\AppData\Local\Programs\Python\Python314\python.exe
Python 3.14.2 (tags/v3.14.2:df79316, Dec  5 2025, 17:18:21) [MSC v.1944 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> exit

C:\Users\YOURUSER>C:\Users\YOURUSER\AppData\Local\Programs\Python\Python314\python.exe  -m pip install --upgrade pip
Requirement already satisfied: pip in c:\users\youruser\appdata\local\programs\python\python314\lib\site-packages (25.3)

C:\Users\YOURUSER>C:\Users\YOURUSER\AppData\Local\Programs\Python\Python314\python.exe -m pip install Pillow
Collecting Pillow
  Downloading pillow-12.0.0-cp314-cp314-win_amd64.whl.metadata (9.0 kB)
Downloading pillow-12.0.0-cp314-cp314-win_amd64.whl (7.1 MB)
   ---------------------------------------- 7.1/7.1 MB 10.5 MB/s  0:00:00
Installing collected packages: Pillow
Successfully installed Pillow-12.0.0

C:\Users\YOURUSER>C:\Users\YOURUSER\AppData\Local\Programs\Python\Python314\python.exe -m pip install --upgrade Pillow
Requirement already satisfied: Pillow in c:\users\youruser\appdata\local\programs\python\python314\lib\site-packages (12.0.0)
  • after this you can use this python version in your slicer like:
"C:\Users\YOURUSER\AppData\Local\Programs\Python\Python314\python.exe" "C:\Users\YOURUSER\AppData\Roaming\OrcaSlicer\user\default\process\E3S1PROFORKBYTT_printdata_orcaslicer_v20_thumbnail.py";

Clone this wiki locally