🎉 WIN a Snapmaker U1 Printer! Enter FREE now

--export-png

<option>
Output Bambu Studio 2.1.0+only

Render one or all plates from a loaded 3MF to 512×512 orthographic PNG files at a configurable camera angle, must be the only CLI action in the invocation, and on Linux can run fully headless via OSMesa without a virtual display.

Details

--export-png renders a PNG preview image for one or all plates in a loaded 3MF. Pass 0 to render every plate in the file, or a positive integer to render only that plate by its 1-based index. The flag is mutually exclusive with other CLI actions: supplying any second action alongside it is rejected with an invalid-parameters error before anything is written.

The render is done through the same OpenGL thumbnail path used to generate the preview images stored inside a 3MF. The camera is always orthographic. The angle is controlled by the companion flag --camera-view, whose integer value selects the named camera angle: 0=Iso (the default), 1=Top_Front, 2=Left, 3=Right, 10=Iso_1 (Iso rotated 90° clockwise), 11=Iso_2 (180°), 12=Iso_3 (270°). Each output file is 512×512 pixels, named plate_{N}_{angle}.png where N is the 1-based plate number and {angle} is the integer value passed to --camera-view. If --outputdir is supplied, files land in that directory; otherwise they are written to the current working directory.

OpenGL must initialise successfully for any PNG to be produced. On Linux the build uses the OSMesa off-screen rendering API, so rendering can succeed in a fully headless environment with no display or virtual framebuffer. On other platforms a real or virtual display is required. When initialisation fails the render block is silently skipped: no PNGs are written, no non-zero exit code is returned, and the process exits normally; the failure is recorded in the internal debug log.

Examples

Render plate 1 as a PNG
--slice 1 --export-png 1 --camera-view 0 \
  --outputdir ./out model.3mf

Watch out for

  • The flag is a standalone action; pairing it with --slice, --export-3mf, or any other action causes an immediate exit with CLI_INVALID_PARAMS before any file is produced.
  • OpenGL must initialise successfully for any PNG to be produced. On Linux the implementation uses the OSMesa off-screen context API, so a virtual display (Xvfb) is not required. On macOS and Windows no equivalent off-screen path exists in the code, so a display is required on those platforms.
  • The output filename is determined entirely by the plate number and the --camera-view integer, not by any user-supplied path. There is no way to specify a custom output filename; only the destination directory (--outputdir) is configurable.
  • Values for --camera-view outside the seven documented ones (0, 1, 2, 3, 10, 11, 12) are cast directly to the enum without range validation. The values 4 (Top), 5 (Bottom), 6 (Front), 7 (Rear), and 9 (Top_Plate) all have explicit dispatch cases and produce well-defined results. Values that have no matching case -- notably 8, which is an internal Count sentinel, and any value >= 13 -- fall through to a no-op default, leaving the camera orientation in an unspecified state.

Related flags

Sign up for free today

No credit card required. Connect unlimited printers and get production automation running in minutes.