### Method

# Vips Image resize

#### Declaration [src]

    int
    vips_resize (
      VipsImage* in,
      VipsImage** out,
      double scale,
      ...
    )

#### Description [src]

Resize an image.

Set `gap` to speed up downsizing by having `vips_shrink()` to shrink with a box filter first. The bigger `gap`, the closer the result to the fair resampling. The smaller `gap`, the faster resizing. The default value is 2.0 (very close to fair resampling while still being faster in many cases).

`vips_resize()` normally uses `VIPS_KERNEL_LANCZOS3` for the final reduce, you can change this with `kernel`. Downsizing is done with centre convention.

When upsizing (`scale` > 1), the operation uses `vips_affine()` with a `VipsInterpolate` selected depending on `kernel`. It will use `VipsInterpolate` “bicubic” for `VIPS_KERNEL_CUBIC` and above. It adds a 0.5 pixel displacement to the input pixels to get centre convention scaling.

`vips_resize()` normally maintains the image aspect ratio. If you set `vscale`, that factor is used for the vertical scale and `scale` for the horizontal.

If either axis would drop below 1px in size, the shrink in that dimension is limited. This breaks the image aspect ratio, but prevents errors due to fractional pixel sizes.

This operation does not change xres or yres. The image resolution needs to be updated by the application.

This operation does not premultiply alpha. If your image has an alpha channel, you should use `vips_premultiply()` on it first.

optional arguments

- `vscale`: `gdouble`, vertical scale factor
- `kernel`: `VipsKernel`, kernel to reduce with (default: `VIPS_KERNEL_LANCZOS3`)
- `gap`: `gdouble`, reducing gap to use (default: 2.0)

See also

`vips_premultiply()`, `vips_shrink()`, `vips_reduce()`.

This method is not directly available to language bindings.

#### Parameters

`out`

  Type: `VipsImage`

  Output image.

  The argument will be set by the function.
  The caller of the method takes ownership of the returned data, and is responsible for freeing it.

`scale`

  Type: `double`

  Scale factor.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.