[Digikam-devel] extragear/graphics/digikam
Gilles Caulier
caulier.gilles at kdemail.net
Tue Dec 19 15:30:01 GMT 2006
SVN commit 614945 by cgilles:
digiKam from trunk : native support of JPEG2000 file format.
JPEG2000 is an advanced picture compression file format based on wavelet theory. It support 16 bits/color/pixel, metadata, and ICC color profile. Look url below for more informations:
http://www.ece.uvic.ca/~mdadams/jasper
http://en.wikipedia.org/wiki/JPEG_2000
http://www.geocities.com/ee00224/btp2.html
http://www.photozone.de/7Digital/jpeg2000.htm
Still TODO with this JPEG2000 loader :
- The JPEG2000 quality level settings is the same than JPEG in setup dialog. We need to create a dedicaced widget settings for each digiKam image loader (TIFF/PNG/JPEG/JPEG2000). There is a file in B.K.O about this subject.
- YCbCr color space is not yet supported. In fact, because digiKam support only RGB* color space, we need to have an ICC color method to transform non-RGB* color space to RGB* using lcms libary for all image file formats witch can do use it (JPEG/JPEG2000/TIFF).
- Embedding ICC color profile doesn't work. It implemented but something still wrong.
- JPEG2000 Metadata extraction (EXIF/IPTC) not yet done in Exiv2.
To packagers : digiKam have a new library depency : libJasper.
CCMAIL: digikam-devel at kde.org
M +5 -1 README
M +12 -1 configure.in.bot
M +19 -1 configure.in.in
M +34 -3 libs/dimg/dimg.cpp
M +1 -0 libs/dimg/dimg.h
M +7 -6 libs/dimg/loaders/Makefile.am
M +2 -2 libs/dimg/loaders/README
M +1 -1 utilities/setup/setupiofiles.cpp
--- trunk/extragear/graphics/digikam/README #614944:614945
@@ -78,7 +78,7 @@
AutoConf >= 2.5.x http://www.gnu.org/software/autoconf
AutoMake >= 1.7.x http://www.gnu.org/software/automake
-KDE >= 3.x (>=3.5.x recommended) http://www.kde.org
+libkde >= 3.x (>=3.5.x recommended) http://www.kde.org
libsqlite >= 3.x http://www.sqlite.org
libexiv2 >= 0.12 http://www.exiv2.org
libgphoto2 >= 2.x (>=2.2.x recommended) http://www.gphoto.org
@@ -86,7 +86,11 @@
liblcms >= 1.14.x http://www.littlecms.com
libtiff >= 3.6.x (>=3.8.2 recommended) http://www.remotesensing.org/libtiff
libpng >= 1.2.x http://www.libpng.org/pub/png/libpng.html
+libjasper >= 1.7.x http://www.ece.uvic.ca/~mdadams/jasper
+Note : all libraries depencies requires developement and binary packages installed on your
+computer to compile digiKam.
+
-- INSTALLATION --------------------------------------------------------
In the source directory do :
--- trunk/extragear/graphics/digikam/configure.in.bot #614944:614945
@@ -59,6 +59,17 @@
echo "-- libpng found................... YES"
fi
+if test "x$have_jasper" != "xyes"; then
+ echo "-- libjasper found................ NO"
+ echo ""
+ echo "digiKam needs libjasper to support JPEG2000. You need to install the correct version (>= 1.7.0)."
+ echo "Libjasper website is at http://www.ece.uvic.ca/~mdadams/jasper"
+ echo ""
+ all_tests=bad
+else
+ echo "-- libjasper found................ YES"
+fi
+
if test "x$have_lcms" != "xyes"; then
echo "-- lcms found..................... NO"
echo ""
@@ -73,7 +84,7 @@
if test "x$have_exiv2" != "xyes"; then
echo "-- Exiv2 library found............ NO"
echo ""
- echo "digiKam needs Exiv2 library >= 0.12. You need to install Exiv2 first"
+ echo "digiKam needs Exiv2 library. You need to install the correct version (>= 0.12)."
echo "Exiv2 website is at http://www.exiv2.org"
echo ""
all_tests=bad
--- trunk/extragear/graphics/digikam/configure.in.in #614944:614945
@@ -1,6 +1,6 @@
#MIN_CONFIG(3)
-AM_INIT_AUTOMAKE(digikam,0.9.0)
+AM_INIT_AUTOMAKE(digikam,0.9.1)
# -----------------------------------------------------------------
# enable hidden visibility only if kde >= 3.3.2 and kdelibs has
@@ -211,6 +211,24 @@
fi
#------------------------------------------------------------------
+# Check for libjasper (JPEG2000)
+#------------------------------------------------------------------
+
+have_jasper=no
+KDE_CHECK_LIB(jasper, jas_init,
+ have_jasper=yes,
+ AC_MSG_WARN([digiKam requires libjasper >= 1.7.0]),
+ -ljasper)
+
+if test "x$have_jasper" != "xyes"; then
+ AC_WARN([digiKam requires libjasper >= 1.7.0; digiKam will not be compiled.])
+ DO_NOT_COMPILE="digikam digikamimageplugins $DO_NOT_COMPILE"
+else
+ LIB_JASPER="-ljasper"
+ AC_SUBST(LIB_JASPER)
+fi
+
+#------------------------------------------------------------------
# Check for Exiv2 library
#------------------------------------------------------------------
--- trunk/extragear/graphics/digikam/libs/dimg/dimg.cpp #614944:614945
@@ -46,6 +46,7 @@
#include "tiffloader.h"
#include "ppmloader.h"
#include "rawloader.h"
+#include "jp2kloader.h"
#include "qimageloader.h"
#include "dimgprivate.h"
#include "dimgloaderobserver.h"
@@ -357,6 +358,20 @@
}
break;
}
+ case(JP2K):
+ {
+ DDebug() << filePath << " : JPEG2000 file identified" << endl;
+ JP2KLoader loader(this);
+ if (loader.load(filePath, observer))
+ {
+ m_priv->null = false;
+ m_priv->alpha = loader.hasAlpha();
+ m_priv->sixteenBit = loader.sixteenBit();
+ m_priv->isReadOnly = loader.isReadOnly();
+ return true;
+ }
+ break;
+ }
default:
{
DDebug() << filePath << " : QIMAGE file identified" << endl;
@@ -386,7 +401,7 @@
QString frm = format.upper();
- if (frm == "JPEG" || frm == "JPG" || frm == "JPE" )
+ if (frm == "JPEG" || frm == "JPG" || frm == "JPE")
{
JPEGLoader loader(this);
return loader.save(filePath, observer);
@@ -406,6 +421,11 @@
PPMLoader loader(this);
return loader.save(filePath, observer);
}
+ if (frm == "JP2" || frm == "JPX" || frm == "JPC" || frm == "PGX")
+ {
+ JP2KLoader loader(this);
+ return loader.save(filePath, observer);
+ }
else
{
setAttribute("format", format);
@@ -444,6 +464,10 @@
return TIFF;
else if (rawFilesExt.upper().contains(ext))
return RAW;
+ if (ext == QString("JP2") || ext == QString("JPX") || // JPEG2000 file format
+ ext == QString("JPC") || // JPEG2000 code stream
+ ext == QString("PGX")) // JPEG2000 WM format
+ return JP2K;
}
// In second, we trying to parse file header.
@@ -456,10 +480,10 @@
return NONE;
}
- const int headerLen = 8;
+ const int headerLen = 9;
unsigned char header[headerLen];
- if (fread(&header, 8, 1, f) != 1)
+ if (fread(&header, headerLen, 1, f) != 1)
{
DDebug() << k_funcinfo << "Failed to read header of file \"" << filePath << "\"" << endl;
fclose(f);
@@ -473,6 +497,8 @@
uchar tiffBigID[2] = { 0x4D, 0x4D };
uchar tiffLilID[2] = { 0x49, 0x49 };
uchar pngID[8] = { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A };
+ uchar jp2ID[5] = { 0x6A, 0x50, 0x20, 0x20, 0x0D, };
+ uchar jpcID[2] = { 0xFF, 0x4F };
if (memcmp(&header, &jpegID, 2) == 0) // JPEG file ?
{
@@ -512,6 +538,11 @@
{
return TIFF;
}
+ else if (memcmp(&header[4], &jp2ID, 5) == 0 || // JPEG2000 file ?
+ memcmp(&header, &jpcID, 2) == 0)
+ {
+ return JP2K;
+ }
// In others cases, QImage will be used to try to open file.
return QIMAGE;
--- trunk/extragear/graphics/digikam/libs/dimg/dimg.h #614944:614945
@@ -60,6 +60,7 @@
TIFF,
RAW,
PPM,
+ JP2K,
QIMAGE
};
--- trunk/extragear/graphics/digikam/libs/dimg/loaders/Makefile.am #614944:614945
@@ -4,13 +4,14 @@
noinst_LTLIBRARIES = libdimgloaders.la
libdimgloaders_la_SOURCES = dimgloader.cpp pngloader.cpp jpegloader.cpp tiffloader.cpp \
- rawloader.cpp ppmloader.cpp qimageloader.cpp iccjpeg.c
+ rawloader.cpp ppmloader.cpp qimageloader.cpp iccjpeg.c \
+ jp2kloader.cpp
libdimgloaders_la_LDFLAGS = $(all_libraries) $(KDE_RPATH) \
- $(LIBJPEG) $(LIB_TIFF) $(LIB_PNG)
+ $(LIBJPEG) $(LIB_TIFF) $(LIB_PNG) $(LIB_JASPER)
INCLUDES = $(all_includes) -I$(top_srcdir)/digikam/libs/dimg \
- -I$(top_srcdir)/digikam/libs/dmetadata \
- -I$(top_srcdir)/digikam/libs/dcraw \
- -I$(top_srcdir)/digikam/digikam \
- -I$(top_srcdir)/digikam
+ -I$(top_srcdir)/digikam/libs/dmetadata \
+ -I$(top_srcdir)/digikam/libs/dcraw \
+ -I$(top_srcdir)/digikam/digikam \
+ -I$(top_srcdir)/digikam
--- trunk/extragear/graphics/digikam/libs/dimg/loaders/README #614944:614945
@@ -1,6 +1,6 @@
---------------------------------------------------------------------------
-Native DIMG Loaders status (Gilles Caulier - 2006-05-26)
+Native DIMG Loaders status (Gilles Caulier - 2006-11-29)
Format Read Write ICC MetaData Thumb 8bits 16bits depency Remarks
@@ -9,6 +9,7 @@
TIF/EP Done Done Done Done TODO yes yes libtiff Metadata are EXIF/IPTC/XMP/ICC profil
RAW Done N.A N.A Done Done yes yes dcraw Metadata are EXIF
PPM Done TODO N.A N.A N.A yes yes none
+JPEG2K Done TODO Done TODO N.A yes yes libjasper Metadata are EXIF/XMP/ICC profil
Others file formats are supported only in 8 bits/color/pixel using QImage/kimgio.
QT3.x + KDE 3.4.x support these formats :
@@ -16,7 +17,6 @@
Format Read Write Remarks
PSD yes no Photoshop file format
-JP2 yes yes JPEG 2000 (libjasper)
EXR yes no OpenEXR (libopenexr)
XCF yes no Gimp file format
PBM yes yes
--- trunk/extragear/graphics/digikam/utilities/setup/setupiofiles.cpp #614944:614945
@@ -94,7 +94,7 @@
d->JPEGcompression = new KIntNumInput(75, savingOptionsGroup);
d->JPEGcompression->setRange(1, 100, 1, true );
- d->labelJPEGcompression = new QLabel(i18n("JPEG quality:"), savingOptionsGroup);
+ d->labelJPEGcompression = new QLabel(i18n("JPEG/JPEG2000 quality:"), savingOptionsGroup);
QWhatsThis::add( d->JPEGcompression, i18n("<p>The quality value for JPEG images:<p>"
"<b>1</b>: low quality (high compression and small "
More information about the Digikam-devel
mailing list