Skip to content

Commit 5889a4a

Browse files
committed
Disable strict pixi requirement for libavif >= 0.9.1
Some AVIF image generators didn't include the PixelInformationProperty (pixi), even though strictly speaking they should. In v0.9.2, libavif began requiring this. Let's disable it so we can read those images too.
1 parent edb6b37 commit 5889a4a

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ext/gd/libgd/gd_avif.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,14 @@ gdImagePtr gdImageCreateFromAvifCtx (gdIOCtx *ctx)
342342

343343
decoder = avifDecoderCreate();
344344

345+
// Check if libavif version is >= 0.9.1
346+
#if AVIF_VERSION_MAJOR > 0 || (AVIF_VERSION_MAJOR == 0 && AVIF_VERSION_MINOR > 9) || (AVIF_VERSION_MAJOR == 0 && AVIF_VERSION_MINOR == 9 && AVIF_VERSION_PATCH >= 1)
347+
// If so, allow the PixelInformationProperty ('pixi') to be missing in AV1 image
348+
// items. libheif v1.11.0 or older does not add the 'pixi' item property to
349+
// AV1 image items. (This issue has been corrected in libheif v1.12.0.)
350+
decoder->strictFlags &= ~AVIF_STRICT_PIXI_REQUIRED;
351+
#endif
352+
345353
io = createAvifIOFromCtx(ctx);
346354
if (!io) {
347355
gd_error("avif error - Could not allocate memory");

0 commit comments

Comments
 (0)