From 3ad09de9c4acfb1c17626bfc242e9fa3bf18f1f6 Mon Sep 17 00:00:00 2001 From: Fernando Costa <32777677+ffawkes@users.noreply.github.com> Date: Sat, 1 Oct 2022 14:16:53 -0300 Subject: [PATCH] Support PNG output on older libvips versions --- vips.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/vips.h b/vips.h index 5089bc4..c3ebb86 100644 --- a/vips.h +++ b/vips.h @@ -336,7 +336,7 @@ vips_jpegsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int qual int vips_pngsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int compression, int quality, int interlace, int palette, int speed) { -#if (VIPS_MAJOR_VERSION >= 8 && VIPS_MINOR_VERSION >= 7) +#if (VIPS_MAJOR_VERSION >= 8 && VIPS_MINOR_VERSION >= 12) int effort = 10 - speed; return vips_pngsave_buffer(in, buf, len, "strip", INT_TO_GBOOLEAN(strip), @@ -348,6 +348,15 @@ vips_pngsave_bridge(VipsImage *in, void **buf, size_t *len, int strip, int compr "effort", effort, NULL ); +#elif (VIPS_MAJOR_VERSION >= 8 && VIPS_MINOR_VERSION >= 7) + return vips_pngsave_buffer(in, buf, len, + "strip", INT_TO_GBOOLEAN(strip), + "compression", compression, + "interlace", INT_TO_GBOOLEAN(interlace), + "filter", VIPS_FOREIGN_PNG_FILTER_ALL, + "palette", INT_TO_GBOOLEAN(palette), + NULL + ); #else return vips_pngsave_buffer(in, buf, len, "strip", INT_TO_GBOOLEAN(strip),