# image/png
Return a copy of the image with its output format set to PNG. Encoding with
`image/bytes` / `image/write` then emits PNG (lossless).
## Syntax
[image/png $img ?opts]
## Parameters
- `$img` — an `Image` value
- `$opts` — optional map; `:compression-level` 0–9 (default 6, higher is
smaller). Out-of-range values are clamped, not errors.
## Examples
set img [image/open "test/fixtures/images/test.jpg"] set out [image/png $img %{ compression-level 9 }] [image/format [image/decode [image/bytes $out]]] # → "png"
## Returns
A new `Image` with the same pixels and dimensions but PNG as its output
format. `nil` when the argument is not a live `Image`.
## See Also
`image/encode`, `image/bytes`, `image/write`, `image/base64`