# image/resize
Resize to exactly width x height pixels, returning a new value of the same
type (`Image` or `PixelBuffer`). Bilinear interpolation is the default; pass
`:filter :nearest` for nearest-neighbour (keeps pixel art crisp).
## Syntax
[image/resize $v $w $h ?opts]
## Parameters
- `$v` — an `Image` or `PixelBuffer` value
- `$w`, `$h` — target dimensions in pixels (integers, 1–65500)
- `$opts` — optional map; `:filter :nearest` or `:bilinear` (default
`:bilinear`)
## Examples
set img [image/open "test/fixtures/images/test.png"] [image/dims [image/resize $img 4 3]] # → %{ :w 4 :h 3 } [image/dims [image/resize $img 16 12 %{ filter :nearest }]] # → %{ :w 16 :h 12 } set buf [image/load "test/fixtures/images/test.png"] [image/dims [image/resize $buf 16 12 %{ filter :nearest }]] # → %{ :w 16 :h 12 } [image/resize $img 0 3] # → %Err{:message "image/resize: width/height out of range"}
## Returns
A new `Image`/`PixelBuffer`; the source is unchanged. `%Err{:message}` when
`$w`/`$h` are missing, non-integer, below 1, or above 65500. `nil` when `$v`
is neither an `Image` nor a `PixelBuffer`.
## See Also
`image/rotate`, `image/flip`, `image/encode`, `image/dims`