Skip to content

Conversation

kleisauke
Copy link
Member

i.e. after setting the metadata and phyiscal pixel dimensions, since quantisation will overwrite the image.

Before:

$ vips copy fruit-g236fa3733_1920.png x.png[palette]
$ vipsheader -f xres x.png
1
$ vipsheader -f icc-profile-data x.png
vipsheader: vips_image_get: field "icc-profile-data" not found

After:

$ vips copy fruit-g236fa3733_1920.png x.png[palette]
$ vipsheader -f xres x.png
2.835
$ vipsheader -f icc-profile-data x.png
<base64-encoded binary data>

Targets the 8.13 branch as this is a bug fix.

Originally reported at lovell/sharp#3392.

i.e. after setting the metadata and phyiscal pixel dimensions,
since quantisation will overwrite the image.
@kleisauke
Copy link
Member Author

Oh, perhaps we need to move this:

/* Low-bitdepth write needs an extra buffer for packing pixels.
*/
if( spng->bitdepth < 8 ) {
spng->sizeof_line = 1 + VIPS_IMAGE_SIZEOF_LINE( in ) /
(8 / spng->bitdepth);
if( !(spng->line =
vips_malloc( NULL, VIPS_IMAGE_SIZEOF_LINE( in ) )) )
return( -1 );
}

After the quantisation?

For low-bitdepth write and palette-based output.
@kleisauke
Copy link
Member Author

... 2a90aec, but that makes the overall diff a bit harder to review. PR is best viewed by commit.

@jcupitt jcupitt merged commit f38acde into libvips:8.13 Oct 14, 2022
@kleisauke kleisauke deleted the 8.13-spngsave-quantisation-last branch October 14, 2022 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants