diff --git a/ChangeLog b/ChangeLog index 9472ceac..5f6e56eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -30,6 +30,7 @@ - add support for ICC profiles and linear encoding to JXL load and save [f1ac] - add "reoptimise" to gifsave [dloebl] - add "bitdepth" to magicksave [dloebl] +- change default PNG filter to "none" [lovell] 26/11/21 started 8.12.3 - better arg checking for vips_hist_find_ndim() [travisbell] diff --git a/libvips/foreign/pngsave.c b/libvips/foreign/pngsave.c index a960c1c8..78cf506b 100644 --- a/libvips/foreign/pngsave.c +++ b/libvips/foreign/pngsave.c @@ -8,6 +8,8 @@ * - support png8 palette write with palette, colours, Q, dither * 24/6/20 * - add @bitdepth, deprecate @colours + * 15/7/22 [lovell] + * - default filter to none */ /* @@ -135,13 +137,6 @@ vips_foreign_save_png_build( VipsObject *object ) if( !vips_object_argument_isset( object, "bitdepth" ) ) png->bitdepth = in->BandFmt == VIPS_FORMAT_UCHAR ? 8 : 16; - /* Filtering usually reduces the compression ratio for palette images, - * so default off. - */ - if( !vips_object_argument_isset( object, "filter" ) && - png->palette ) - png->filter = VIPS_FOREIGN_PNG_FILTER_NONE; - /* If this is a RGB or RGBA image and a low bit depth has been * requested, enable palettization. */ @@ -234,7 +229,7 @@ vips_foreign_save_png_class_init( VipsForeignSavePngClass *class ) VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsForeignSavePng, filter ), VIPS_TYPE_FOREIGN_PNG_FILTER, - VIPS_FOREIGN_PNG_FILTER_ALL ); + VIPS_FOREIGN_PNG_FILTER_NONE ); VIPS_ARG_BOOL( class, "palette", 13, _( "Palette" ), @@ -284,7 +279,7 @@ static void vips_foreign_save_png_init( VipsForeignSavePng *png ) { png->compression = 6; - png->filter = VIPS_FOREIGN_PNG_FILTER_ALL; + png->filter = VIPS_FOREIGN_PNG_FILTER_NONE; png->Q = 100; png->dither = 1.0; png->effort = 7; @@ -493,9 +488,8 @@ vips_foreign_save_png_buffer_init( VipsForeignSavePngBuffer *buffer ) * contains an ICC profile named VIPS_META_ICC_NAME ("icc-profile-data"), the * profile from the VIPS header will be attached. * - * Use @filter to specify one or more filters (instead of adaptive filtering), - * see #VipsForeignPngFilter. @filter defaults to NONE for palette images, - * since they generally have very low local correlation. + * 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 diff --git a/libvips/foreign/spngsave.c b/libvips/foreign/spngsave.c index 8ddb9825..5162e189 100644 --- a/libvips/foreign/spngsave.c +++ b/libvips/foreign/spngsave.c @@ -10,6 +10,8 @@ * - add @bitdepth, deprecate @colours * 11/11/21 * - use libspng for save + * 15/7/22 [lovell] + * - default filter to none */ /* @@ -681,7 +683,7 @@ vips_foreign_save_spng_class_init( VipsForeignSaveSpngClass *class ) VIPS_ARGUMENT_OPTIONAL_INPUT, G_STRUCT_OFFSET( VipsForeignSaveSpng, filter ), VIPS_TYPE_FOREIGN_PNG_FILTER, - VIPS_FOREIGN_PNG_FILTER_ALL ); + VIPS_FOREIGN_PNG_FILTER_NONE ); VIPS_ARG_BOOL( class, "palette", 13, _( "Palette" ), @@ -731,7 +733,7 @@ static void vips_foreign_save_spng_init( VipsForeignSaveSpng *spng ) { spng->compression = 6; - spng->filter = VIPS_FOREIGN_PNG_FILTER_ALL; + spng->filter = VIPS_FOREIGN_PNG_FILTER_NONE; spng->Q = 100; spng->dither = 1.0; spng->effort = 7;