---
title: "RenderResult"
description: "PNG bytes and world-to-pixel transform metadata returned by render_png."
canonical_url: "https://www.rosette.dev/docs/api-reference/RenderResult"
markdown_url: "https://www.rosette.dev/docs/api-reference/RenderResult.md"
source_url: "https://github.com/PreFab-Photonics/rosette/blob/f086d7670645fd36c05362d696d442a2b2e74850/www/content/docs/api-reference/RenderResult.mdx"
docs_channel: "main"
docs_revision: "f086d7670645fd36c05362d696d442a2b2e74850"
---

# RenderResult

Result of a [`render_png()`](/docs/api-reference#render_png) call: the PNG image bytes plus
the world↔pixel transform metadata needed to map between design (micron) and
image (pixel) coordinates.

Import with `from rosette.render import RenderResult`.



> **Warning: Experimental**
>
> The rendering API (`render_png` / `RenderResult`) is evolving. Property shapes
> (notably the `view` metadata) and method signatures may change without notice.



```python
from rosette.render import render_png

result = render_png(library, width=1024)
png_bytes = result.png
x, y = result.px_to_world(512, 256)
```

## Attributes



### `png`

```python
png: bytes
```

PNG-encoded image bytes.





### `view`

```python
view: dict[str, object]
```

World↔pixel transform metadata (scale, offsets, canvas size, and the visible
world bbox in microns). See the public API contract in `python/rosette/api.pyi` for
the current key set, which may change.





### `layers_rendered`

```python
layers_rendered: list[tuple[int, int]]
```

`(layer, datatype)` pairs that contributed pixels, in draw order.



## Methods



### `px_to_world`

```python
px_to_world(px, py) -> tuple[float, float]
```

Convert a pixel coordinate in the rendered image back to design (micron)
coordinates.



- **`px`** (`float`)

  Horizontal pixel coordinate.





- **`py`** (`float`)

  Vertical pixel coordinate.





**Returns:** `tuple[float, float]`





### `world_to_px`

```python
world_to_px(x, y) -> tuple[float, float]
```

Convert design (micron) coordinates to a pixel position in the rendered image.



- **`x`** (`float`)

  Horizontal design coordinate in microns.





- **`y`** (`float`)

  Vertical design coordinate in microns.





**Returns:** `tuple[float, float]`