Method

VipsImageheifsave

Declaration [src]

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

Description [src]

Optional arguments:

  • Q: %gint, quality factor
  • bitdepth: %gint, set write bit depth to 8, 10, or 12 bits
  • lossless: %gboolean, enable lossless encoding
  • compression: VipsForeignHeifCompression, write with this compression
  • effort: %gint, encoding effort
  • subsample_mode: VipsForeignSubsample, chroma subsampling mode

Write a VIPS image to a file in HEIF format.

Use Q to set the compression factor. Default 50, which seems to be roughly what the iphone uses. Q 30 gives about the same quality as JPEG Q 75.

Set lossless TRUE to switch to lossless compression.

Use compression to set the encoder e.g. HEVC, AVC, AV1. It defaults to AV1 if the target filename ends with “.avif”, otherwise HEVC.

Use effort to control the CPU effort spent improving compression. This is currently only applicable to AV1 encoders. Defaults to 4, 0 is fastest, 9 is slowest.

Chroma subsampling is normally automatically disabled for Q >= 90. You can force the subsampling mode with subsample_mode.

Use bitdepth to set the bitdepth of the output file. HEIC supports at least 8, 10 and 12 bits; other codecs may support more or fewer options.

See also: vips_image_write_to_file(), vips_heifload().

This method is not directly available to language bindings.

Parameters

filename const char*
 

File to write to.

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

NULL-terminated list of optional named arguments.

Return value

Returns: int
 

0 on success, -1 on error.