Repository navigation
Support GIF output and palette PNG output - #51
Merged
Merged
Conversation
libvips writes GIF files through cgif and only enables cgif when an image
quantiser is available; the same quantiser is needed for palette PNG output.
Neither was built, so gifsave_buffer was missing and png({ palette: true })
was silently ignored.
Build libimagequant 2.4.1 (the BSD-licensed fork used by sharp's prebuilt
binaries) and cgif 0.5.4 from pinned, checksum-verified tarballs, enable both
explicitly in libvips so a missing dependency fails the build, and check for
gifsave_buffer after building libvips.
Add layer tests for static GIF, animated GIF and palette PNG output.
Fixes #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13.
Problem
Saving a GIF fails with
VipsOperation: class "gifsave_buffer" not found, andpng({ palette: true })quietly writes a truecolour PNG. Stock sharp (prebuilt binaries) supports both, so switching to this layer silently drops them.libvips 8.18 writes GIF files through cgif, and its
meson.buildonly looks for cgif once an image quantiser (libimagequant or quantizr) has been found. Palette PNG output needs the same quantiser; without one libvips logsignoring palette (no quantisation support)and carries on. The layer built neither.Changes
layer/Makefile-Dimagequant=enabled -Dcgif=enabledto libvips. Without forcing the quantiser on, a missing libimagequant would quietly disable cgif instead of failing the build.verifyLibvipsnow also checks forgifsave_buffer./usr/local/lib, and the existingldd-based step copies them into the layer'slib/.test/layer.test.jsgif.GIF89asignature and the quadrant colours.sharp(buf, { animated: true }).resize().gif()). Check the frame count and size, and the colours of both frames.isPaletteis true. Because libvips silently falls back to truecolour, checking only that the call succeeds would not catch a missing quantiser.README.md: a note on GIF and palette PNG output, plus license and repository entries for cgif and libimagequant.Testing
palette: trueremoved, the palette PNG test fails as expected (PNG colour type should be indexed).