From b58b7bd416a34c299d2b367098a2ce6e1d968077 Mon Sep 17 00:00:00 2001 From: Lovell Fuller Date: Thu, 8 Sep 2022 09:10:02 +0100 Subject: [PATCH] pngsave: ensure 8-bit palette images can be created (#3031) --- libvips/foreign/pngsave.c | 6 +++--- libvips/foreign/spngsave.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libvips/foreign/pngsave.c b/libvips/foreign/pngsave.c index 2b9711f5..eea9966e 100644 --- a/libvips/foreign/pngsave.c +++ b/libvips/foreign/pngsave.c @@ -145,9 +145,9 @@ vips_foreign_save_png_build( VipsObject *object ) png->bitdepth < 8 ) png->palette = TRUE; - /* Disable palettization for >8 bit save. - */ - if( png->bitdepth >= 8 ) + /* Disable palettization for >8 bit save. + */ + if( png->bitdepth > 8 ) png->palette = FALSE; if( vips__png_write_target( in, png->target, diff --git a/libvips/foreign/spngsave.c b/libvips/foreign/spngsave.c index 7ff47739..a40be6e4 100644 --- a/libvips/foreign/spngsave.c +++ b/libvips/foreign/spngsave.c @@ -613,9 +613,9 @@ vips_foreign_save_spng_build( VipsObject *object ) spng->bitdepth < 8 ) spng->palette = TRUE; - /* Disable palettization for >8 bit save. - */ - if( spng->bitdepth >= 8 ) + /* Disable palettization for >8 bit save. + */ + if( spng->bitdepth > 8 ) spng->palette = FALSE; if( vips_foreign_save_spng_write( spng, in ) ) {