From cd6707c1d23f0c552b12a09691cc8696c7212dea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Wed, 27 Apr 2022 17:16:35 +0200 Subject: Add support for Jasper 3.x. This resolves issue #4. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit d9d028f1e239546736bd4303133b180fc037d1a2) --- digikam/libs/dimg/loaders/jp2kloader.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/digikam/libs/dimg/loaders/jp2kloader.cpp b/digikam/libs/dimg/loaders/jp2kloader.cpp index 10353919..66351c25 100644 --- a/digikam/libs/dimg/loaders/jp2kloader.cpp +++ b/digikam/libs/dimg/loaders/jp2kloader.cpp @@ -660,7 +660,17 @@ bool JP2KLoader::save(const TQString& filePath, DImgLoaderObserver *observer) DDebug() << "JPEG2000 quality: " << quality << endl; DDebug() << "JPEG2000 " << rate << endl; +# if defined(JAS_VERSION_MAJOR) && (JAS_VERSION_MAJOR >= 3) + const jas_image_fmtinfo_t *jp2_fmtinfo = jas_image_lookupfmtbyname("jp2"); + int ret = -1; + if (jp2_fmtinfo) + { + ret = jas_image_encode(jp2_image, jp2_stream, jp2_fmtinfo->id, rate.utf8().data()); + } +# else int ret = jp2_encode(jp2_image, jp2_stream, rate.utf8().data()); +# endif + if (ret != 0) { DDebug() << "Unable to encode JPEG2000 image" << endl; -- cgit v1.2.1