Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pngsave: Change default row filter from 'all' to 'none' #2929

Merged
merged 1 commit into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
18 changes: 6 additions & 12 deletions libvips/foreign/pngsave.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/

/*
Expand Down Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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" ),
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions libvips/foreign/spngsave.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
* - add @bitdepth, deprecate @colours
* 11/11/21
* - use libspng for save
* 15/7/22 [lovell]
* - default filter to none
*/

/*
Expand Down Expand Up @@ -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" ),
Expand Down Expand Up @@ -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;
Expand Down