summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2022-04-27 17:16:35 +0200
committerSlávek Banko <slavek.banko@axis.cz>2022-04-29 00:48:33 +0200
commitd9d028f1e239546736bd4303133b180fc037d1a2 (patch)
tree1b94e8cd5aadbdac2cd602674893abc834669844
parentcfa478f5194af0533b39a5f584fc384ca903d2ae (diff)
downloaddigikam-d9d028f1e239546736bd4303133b180fc037d1a2.tar.gz
digikam-d9d028f1e239546736bd4303133b180fc037d1a2.zip
Add support for Jasper 3.x.
This resolves issue #4. Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
-rw-r--r--digikam/libs/dimg/loaders/jp2kloader.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/digikam/libs/dimg/loaders/jp2kloader.cpp b/digikam/libs/dimg/loaders/jp2kloader.cpp
index 1035391..66351c2 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;