From 34427d83a028690b098fd1f67e956f78bc724e22 Mon Sep 17 00:00:00 2001 From: Kleis Auke Wolthuizen Date: Sun, 14 Aug 2022 16:53:33 +0200 Subject: [PATCH] jxlsave: correctly mark frame as last (#2988) It's required to close the input, otherwise the encoder can't know what the last frame is, resulting in an improper codestream. Resolves: #2987. --- libvips/foreign/jxlsave.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libvips/foreign/jxlsave.c b/libvips/foreign/jxlsave.c index 94ed4fa2..cd2c51b7 100644 --- a/libvips/foreign/jxlsave.c +++ b/libvips/foreign/jxlsave.c @@ -438,6 +438,11 @@ vips_foreign_save_jxl_build( VipsObject *object ) return( -1 ); } + /* This function must be called after the final frame and/or box, + * otherwise the codestream will not be encoded correctly. + */ + JxlEncoderCloseInput( jxl->encoder ); + do { uint8_t *out; size_t avail_out;