Python: Crop Window#

Renders the center 512×512 region of a 1024×1024 RenderProduct by authoring dataWindowNDC = (0.25, 0.25, 0.75, 0.75). The example verifies the mapped LdrColor dimensions before displaying the crop or saving it as a PNG.

“Create an example that renders a centered dataWindowNDC crop from a full-resolution RenderProduct, verifies the cropped output dimensions, and saves or displays the result.”

Center crop rendered with dataWindowNDC

Prerequisites#

  • Python 3.10-3.13

  • uv

  • An NVIDIA RTX-capable GPU and a supported driver

Running#

cd examples/python/crop-window
uv run main.py

Pass --png to save _output/render.png instead of displaying the image.