### Method

# Vips Image ppmsave

#### Declaration [src]

    int
    vips_ppmsave (
      VipsImage* in,
      const char* filename,
      ...
    )

#### Description [src]

Write a VIPS image to a file as PPM.

It can write 1, 8, 16 or 32 bit unsigned integer images, float images, colour or monochrome, stored as binary or ASCII. Integer images of more than 8 bits can only be stored in ASCII.

When writing float (PFM) images the scale factor is set from the “pfm-scale” metadata.

Set `ascii` to `TRUE` to write as human-readable ASCII. Normally data is written in binary.

Set `bitdepth` to 1 to write a one-bit image.

`format` defaults to the sub-type for this filename suffix.

Optional arguments

- `format`: `VipsForeignPpmFormat`, format to save in
- `ascii`: `gboolean`, save as ASCII rather than binary
- `bitdepth`: `gint`, bitdepth to save at

See also

`vips_image_write_to_file()`.

This method is not directly available to language bindings.

#### Parameters

`filename`

  Type: `const char*`

  File to write to.

  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`...`

  Type: ``

  `NULL`-terminated list of optional named arguments.

#### Return value

Type: `int`

0 on success, -1 on error.