summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;