Method
VipsImagepngsave
Declaration [src]
int
vips_pngsave (
VipsImage* in,
const char* filename,
...
)
Description [src]
Write a VIPS image to a file as PNG.
compression means compress with this much effort (0 - 9). Default 6.
Set interlace to TRUE to interlace the image with ADAM7
interlacing. Beware
than an interlaced PNG can be up to 7 times slower to write than a
non-interlaced image.
Use filter to specify one or more filters, defaults to none,
see VipsForeignPngFilter.
The image is automatically converted to RGB, RGBA, Monochrome or Mono + alpha before saving. Images with more than one byte per band element are saved as 16-bit PNG, others are saved as 8-bit PNG.
Set palette to TRUE to enable palette mode for RGB or RGBA images. A
palette will be computed with enough space for bitdepth (1, 2, 4 or 8)
bits. Use Q to set the optimisation effort, 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).
This feature requires libvips to be compiled with libimagequant.
The default bitdepth is either 8 or 16 depending on the interpretation.
You can also set bitdepth for mono and mono + alpha images, and the image
will be quantized.
XMP metadata is written to the XMP chunk. PNG comments are written to separate text chunks.
If the image has a page height set (so it is a stack of frames, perhaps from an animated GIF or WebP load), an animated PNG (APNG) is written, using the “delay” and “loop” metadata for frame timing. This needs libvips to be compiled with an APNG-capable libpng.
Optional arguments
compression:gint, compression levelinterlace:gboolean, interlace imagefilter:VipsForeignPngFilter, row filter flag(s)palette:gboolean, enable quantisation to 8bpp paletteQ:gint, quality for 8bpp quantisationdither:gdouble, amount of dithering for 8bpp quantizationbitdepth:gint, set write bit depth to 1, 2, 4, 8 or 16effort:gint, quantisation CPU effort
See also
This method is not directly available to language bindings.