Constructor

VipsImagepngload

Declaration [src]

int
vips_pngload (
  const char* filename,
  VipsImage** out,
  ...
)

Description [src]

Read a PNG file into a VIPS image. It can read all png images, including 8- and 16-bit images, 1 and 3 channel, with and without an alpha channel.

Any ICC profile is read and attached to the VIPS image. It also supports XMP metadata.

Use fail_on to set the type of error that will cause load to fail. By default, loaders are permissive, that is, VIPS_FAIL_ON_NONE.

By default, the PNG loader limits the number of text and data chunks to block some denial of service attacks. Set unlimited to disable these limits.

Use page to set the first page (frame) to load, and n to set the number of pages to load. Set n to -1 to load all pages from page onwards. By default, only the first page is loaded.

For animated PNGs (APNG), pages are stacked vertically in the output image.

Optional arguments

  • fail_on: VipsFailOn, types of read error to fail on
  • unlimited: gboolean, Remove all denial of service limits
  • page: gint, first page to load
  • n: gint, number of pages to load, -1 for all

This constructor is not directly available to language bindings.

Parameters

filename

Type: const char*

File to load.

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

Type: VipsImage

Decompressed image.

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

Type: 

NULL-terminated list of optional named arguments.

Return value

Type: int

0 on success, -1 on error.