LibGfx: Support AVIF images with missing pixi property

This commit is contained in:
Psychpsyo 2024-11-10 17:39:40 +01:00
parent 8a07131229
commit a701a5d97f
2 changed files with 5 additions and 0 deletions

View file

@ -68,6 +68,11 @@ static ErrorOr<void> decode_avif_header(AVIFLoadingContext& context)
if (context.decoder == nullptr) {
return Error::from_string_literal("failed to allocate AVIF decoder");
}
// This makes the decoder not error if an item in the file is missing the mandatory pixi property.
// Reason for this is that older versions of ImageMagick do not set this property, which leads to
// broken web content if the error is not ignored.
context.decoder->strictFlags &= ~AVIF_STRICT_PIXI_REQUIRED;
}
avifResult result = avifDecoderSetIOMemory(context.decoder, context.data.data(), context.data.size());