Vips.Image.gifsave

### Method

# Vips Imagegifsave

#### Declaration [src]

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

#### Description [src]

Write to a file in GIF format.

Use `dither` to set the degree of Floyd-Steinberg dithering and `effort` to control the CPU effort (1 is the fastest, 10 is the slowest, 7 is the default).

Use `bitdepth` (from 1 to 8, default 8) to control the number of colours in the palette. The first entry in the palette is always reserved for transparency. For example, a bitdepth of 4 will allow the output to contain up to 15 colours.

Use `interframe_maxerror` to set the threshold below which pixels are considered equal. Pixels which don’t change from frame to frame can be made transparent, improving the compression rate. Default 0.

Use `interpalette_maxerror` to set the threshold below which the previously generated palette will be reused.

If `reuse` is `TRUE`, the GIF will be saved with a single global palette taken from the metadata in `in`, and no new palette optimisation will be done.

If `interlace` is `TRUE`, the GIF file will be interlaced (progressive GIF). These files may be better for display over a slow network connection, but need more memory to encode.

If `keep_duplicate_frames` is `TRUE`, duplicate frames in the input will be kept in the output instead of combining them.

Optional arguments

- `dither`: `gdouble`, quantisation dithering level
- `effort`: `gint`, quantisation CPU effort
- `bitdepth`: `gint`, number of bits per pixel
- `interframe_maxerror`: `gdouble`, maximum inter-frame error for transparency
- `reuse`: `gboolean`, reuse palette from input
- `interlace`: `gboolean`, write an interlaced (progressive) GIF
- `interpalette_maxerror`: `gdouble`, maximum inter-palette error for palette reusage
- `keep_duplicate_frames`: `gboolean`, keep duplicate frames in the output instead of combining them

See also

`vips_image_new_from_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.