From d7d5937853d73a17dcb24229d3220a47931e6f7e Mon Sep 17 00:00:00 2001 From: Julian Smith Date: Mon, 12 Feb 2024 22:11:55 +0000 Subject: [PATCH] src/__init__.py: fix use of fz_compressed_image_buffer() with mupdf-1.23.x. --- src/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/__init__.py b/src/__init__.py index 49f80da0e..a2fbf9bc4 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -12597,10 +12597,15 @@ def extractIMGINFO(self, hashes=0): continue img = block.i_image() img_size = 0 - compr_buff = mupdf.fz_compressed_image_buffer(img) - if compr_buff: - img_size = compr_buff.fz_compressed_buffer_size() - compr_buff = None + if mupdf_version_tuple >= (1, 24): + compr_buff = mupdf.fz_compressed_image_buffer(img) + if compr_buff: + img_size = compr_buff.fz_compressed_buffer_size() + compr_buff = None + else: + compr_buff = mupdf.ll_fz_compressed_image_buffer(img.m_internal) + if compr_buff: + img_size = mupdf.ll_fz_compressed_buffer_size(compr_buff) if hashes: r = mupdf.FzIrect(FZ_MIN_INF_RECT, FZ_MIN_INF_RECT, FZ_MAX_INF_RECT, FZ_MAX_INF_RECT) assert mupdf.fz_is_infinite_irect(r)