Bug 58170 - OpenEXR viewer for Konqueror
Summary: OpenEXR viewer for Konqueror
Status: RESOLVED WORKSFORME
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: kimgio (show other bugs)
Version: unspecified
Platform: RedHat Enterprise Linux Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-06 13:37 UTC by Jamo
Modified: 2004-02-18 09:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
first screenshot of EXR meta-info plugin for konqi (31.54 KB, image/png)
2004-01-14 22:49 UTC, Brad Hards
Details
Updated kfile_plugin (37.41 KB, image/png)
2004-01-15 03:23 UTC, Brad Hards
Details
Screenshot of proposed kimgio plugin (759.93 KB, image/png)
2004-01-23 06:32 UTC, Brad Hards
Details
Updated kfile_plugin (70.88 KB, image/png)
2004-01-24 11:21 UTC, Brad Hards
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jamo 2003-05-06 13:37:16 UTC
Version:            (using KDE KDE 3.1)
Installed from:    RedHat RPMs
OS:          Linux

Similar as 'exrdisplay', but embedded to Konqueror (works same way as viewing PNG/Jpeg pictures, but may optionally present exposure & other sliders to user).

OpenEXR description and downloadable files: http://www.openexr.net/
Comment 1 Thiago Macieira 2003-05-06 13:50:31 UTC
I believe the reporter wants a new image format supported. I believe this is a KImgIO 
wish then. 
 
From the site: ILM has released OpenEXR as a free software [...] It's available under 
the BSD license. 
Comment 2 Brad Hards 2004-01-14 22:47:04 UTC
I'm working on this. I have the image/x-exr.desktop file done, and have a working kfile_plugin - screenshot is attached. The image loading plugin (kimgio) is just a framework at this stage - I wanted to get the autoconf/automake magic working first, and a kfile_plugin was a lot simpler...

It builds on the ILM EXR libs.

For the original reporter - how important is it that the exposure and other sliders work as per exrdisplay? When you say "may optionally present", do you mean that it is the users option, or you'd be just as happy whether they were there or not? The problem is that kimgio doesn't have that kind of linkage to konqueror - it would require a whole new application to be written and embedded in konqueror. It may not be that hard, but I'd like to be able to show EXR images inline (eg in a HTML page, as for JPG and PNG files), and that is a different problem. If you are happy that it just allows viewing at the default settings, then I'll be able to close out the wishlist when this is all committed (for KDE 3.3) - otherwise it will remain open.
Comment 3 Brad Hards 2004-01-14 22:49:42 UTC
Created attachment 4174 [details]
first screenshot of EXR meta-info plugin for konqi

This is what I currently have working for the kfile_plugin. Please advise if
additional information, less information, or different organisation (groups,
etc) is required.
Comment 4 Brad Hards 2004-01-15 03:23:54 UTC
Created attachment 4176 [details]
Updated kfile_plugin

Updated the screenshot based on feedback from OpenEXR list.
Comment 5 Nadeem Hasan 2004-01-16 20:33:45 UTC
Please use the standard names and hints etc. Like for the size, use:

item = addItemInfo( group, "Dimensions", i18n( "Dimensions" ), QVariant::Size );
setHint( item, KFileMimeTypeInfo::Size );
setUnit( item, KFileMimeTypeInfo::Pixels );

Also, why is the image depth (BPP) not listed?
Comment 6 Brad Hards 2004-01-23 06:28:27 UTC
I'll update to reflect the Dimensions, but there is a subtle difference between pixels and samples in the EXR format (because of potential subsampling).
BPP isn't listed because it doesn't have any meaning. Each channel can have separate depth (so red can be 16-bit float, blue can be 32 bit float, etc). That is why the channels are brought out separately.
Comment 7 Brad Hards 2004-01-23 06:30:09 UTC
I've done the kimgio plugin - slow though, because of the ugly format conversion. I'll attach a screenshot.
Comment 8 Brad Hards 2004-01-23 06:32:46 UTC
Created attachment 4307 [details]
Screenshot of proposed kimgio plugin

Screenshot showing kimgio plugin in action, with sample images from ILM.
Comment 9 Brad Hards 2004-01-24 11:21:09 UTC
Created attachment 4330 [details]
Updated kfile_plugin

Screenshot showing the current capabilities of the kfile_plugin for EXR
meta-data. I've added in the proper QSize approach, and also added thumbnail
support.
Comment 10 Brad Hards 2004-02-01 05:40:49 UTC
Subject: kdelibs

CVS commit by bhards: 

This patch adds a kimgio plugin for the OpenEXR file format. OpenEXR is a
product of Industrial Light and Magic, and offers high dynamic range.
Each pixel is a combination of a number of channels, and each channel
is normally a 16 bit floating point number. The plugin converts the
A, R, G and B channels to a QImage, with a standard exposure (0.0),
standard knee values (low = 0.0, high=5.0) and standard defog (0.0).
Changing these is trivial, but supporting variable values will require
an API that provides the ability to pass the values in.

You can find out more about OpenEXR at http://www.openexr.com. There are
sample images in the OpenEXR CVS tree, or you can download a tarball of
samples (http://savannah.nongnu.org/download/openexr/OpenEXR-images.tar.gz
note well: its 12 Meg).

This kimgio plugin depends on the availability of the OpenEXR library,
at least version 1.0.7. You can download RPMs and tarballs from 
http://savannah.nongnu.org/download/openexr/OpenEXR-images.tar.gz. I 
understand that gentoo ebuilds and .debs are also available. 

The stuff in kimgio/configure.in.in should obviously go to 
kde-common/admin/acinclude.m4.in, but I can't seem to get it committed, so
it can hang around in here for now.

There may be performance gains to be made - I'm committing this before
working on any performance issues though.

CCMAIL: 58170@bugs.kde.org


  A            kimgio/exr.cpp   1.1 [no copyright]
  A            kimgio/exr.h   1.1 [no copyright]
  A            kimgio/exr.kimgio   1.1
  M +14 -4     kimgio/Makefile.am   1.51
  M +59 -0     kimgio/configure.in.in   1.8
  M +3 -2      kio/kio/kimageio.h   1.15


--- kdelibs/kimgio/Makefile.am  #1.50:1.51
@@ -10,7 +10,13 @@
 endif
 
+if include_EXR_MODULES
+KIMGIO_EXR_MODULES=kimg_exr.la
+KIMGIO_EXR_DATAFILES=exr.kimgio
+KDE_CXXFLAGS = $(USE_EXCEPTIONS)
+endif
+
 kde_module_LTLIBRARIES= kimg_eps.la kimg_xview.la  \
                  $(KIMGIO_TIFF_MODULES) kimg_ico.la $(KIMGIO_JP2_MODULES) \
-             kimg_pcx.la kimg_tga.la
+             kimg_pcx.la kimg_tga.la $(KIMGIO_EXR_MODULES)
 
 KIMGIO_PLUGIN = -avoid-version -export-symbols-regex 'kimgio_.*_(read|write)'
@@ -48,7 +54,11 @@
 kimg_tga_la_LIBADD = $(LIB_QT) $(LIB_KDECORE)
 
-noinst_HEADERS= xview.h eps.h tiffr.h g3r.h ico.h jp2.h pcx.h tga.h
+kimg_exr_la_SOURCES = exr.cpp
+kimg_exr_la_LDFLAGS = -module $(KIMGIO_PLUGIN) -no-undefined $(all_libraries)
+kimg_exr_la_LIBADD = $(LIB_QT) $(LIB_KDECORE) $(LIB_EXR)
+
+noinst_HEADERS= xview.h eps.h tiffr.h g3r.h ico.h jp2.h pcx.h tga.h exr.h
 
-INCLUDES = -I$(top_srcdir)/kio -I$(top_srcdir)/dcop -I$(top_srcdir)/libltdl $(all_includes)
+INCLUDES = -I$(top_srcdir)/kio -I$(top_srcdir)/dcop -I$(top_srcdir)/libltdl $(all_includes) -Drestrict= $(EXR_FLAGS)
 
 servicedir = $(kde_servicesdir)
@@ -56,3 +66,3 @@
                ppm.kimgio xbm.kimgio jpeg.kimgio xv.kimgio eps.kimgio \
            $(KIMGIO_TIFF_DATAFILES) ico.kimgio $(KIMGIO_JP2_DATAFILES) \
-           gif.kimgio pcx.kimgio tga.kimgio
+           gif.kimgio pcx.kimgio tga.kimgio $(KIMGIO_EXR_DATAFILES)

--- kdelibs/kimgio/configure.in.in  #1.7:1.8
@@ -1,8 +1,67 @@
+AC_DEFUN(AC_FIND_LIBEXR,
+[
+AC_REQUIRE([KDE_CHECK_EXTRA_LIBS])
+AC_REQUIRE([AC_FIND_ZLIB])
+AC_CACHE_VAL(ac_cv_libexr,
+[
+  if test -z "$PKG_CONFIG"; then
+    AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
+  fi
+
+  AC_MSG_CHECKING([for OpenEXR libraries])
+
+  if test "$PKG_CONFIG" = "no" ; then
+     echo "*** The pkg-config script could not be found. Make sure it is"
+     echo "*** in your path, or set the PKG_CONFIG environment variable"
+     echo "*** to the full path to pkg-config."
+     echo "*** Or see http://www.freedesktop.org/software/pkgconfig to get pkg-config."
+  else
+     kde_save_LIBS="$LIBS"
+     LIBS="$LIBS $all_libraries $USER_LDFLAGS -lIlmImf -lImath -lHalf -lIex $LIBZ -lm"
+     AC_LANG_SAVE
+     AC_LANG_CPLUSPLUS
+     kde_save_CXXFLAGS="$CXXFLAGS"
+     EXR_FLAGS=`$PKG_CONFIG --cflags OpenEXR`
+     CXXFLAGS="$CXXFLAGS $all_includes $USER_INCLUDES $EXR_FLAGS"
+
+    AC_TRY_LINK(dnl
+        [
+        #include <ImfRgbaFile.h>
+        ],
+        [
+        using namespace Imf;
+        RgbaInputFile file ("dummy");
+        return 0;
+        ],
+        eval "ac_cv_libexr='-lIlmImf -lImath -lHalf -lIex $LIBZ -lm'",
+        eval "ac_cv_libexr=no"
+    )
+    LIBS="$kde_save_LIBS"
+    CXXFLAGS="$kde_save_CXXFLAGS"
+    AC_LANG_RESTORE
+    ])dnl
+    if eval "test ! \"`echo $ac_cv_libexr`\" = no"; then
+        AC_DEFINE_UNQUOTED(HAVE_EXR, 1, [Define if you have OpenEXR])
+        LIB_EXR="$ac_cv_libexr"
+        AC_MSG_RESULT($ac_cv_libexr)
+    else
+        AC_MSG_RESULT(no)
+        LIB_EXR=""
+    fi
+  fi
+  AC_SUBST(LIB_EXR)
+  AC_SUBST(EXR_FLAGS)
+])
+
+
+
 AC_FIND_TIFF
 AC_FIND_JPEG
 AC_FIND_PNG
 AC_FIND_JASPER
+AC_FIND_LIBEXR
 
 AM_CONDITIONAL(include_TIFF_MODULES, test -n "$LIBTIFF")
 AM_CONDITIONAL(include_JP2_MODULES, test -n "$LIB_JASPER")
+AM_CONDITIONAL(include_EXR_MODULES, test -n "$LIB_EXR")
 

--- kdelibs/kio/kio/kimageio.h  #1.14:1.15
@@ -30,4 +30,5 @@
  * @li BMP     \<read\> \<write\>
  * @li EPS     \<read\> \<write\>
+ * @li EXR     \<read\>
  * @li G3      \<read\>
  * @li GIF     \<read\>


Comment 11 Brad Hards 2004-02-01 07:02:39 UTC
Subject: kdegraphics/kfile-plugins

CVS commit by bhards: 

This patch adds a kfile plugin for the OpenEXR file format. OpenEXR is a
product of Industrial Light and Magic, and offers high dynamic range.
Each pixel is a combination of a number of channels, and each channel
is normally a 16 bit floating point number. The plugin supports the
normal image information (eg width and height), knows how to extract
thumbnails, and supports the "standard attributes" defined by ILM. One
thing it doesn't do is support "bits per pixel", since that has no meaning
in OpenEXR, which is channel based. Instead we provide the list of all
channels. The plugin also supports the special attributes used by
Splutterfish's 3D Studio Max EXR plugin.

You can find out more about OpenEXR at http://www.openexr.com. There are
sample images in the OpenEXR CVS tree, or you can download a tarball of
samples (http://savannah.nongnu.org/download/openexr/OpenEXR-images.tar.gz
note well: its 12 Meg).

This kfile plugin depends on the availability of the OpenEXR library,
at least version 1.0.7. You can download RPMs and tarballs from
http://savannah.nongnu.org/download/openexr/OpenEXR-images.tar.gz. I
understand that gentoo ebuilds and .debs are also available.

The stuff in kfile-plugins/exr/configure.in.in should obviously go to
kde-common/admin/acinclude.m4.in, but I can't seem to get it committed, so
it can hang around in here for now.

CCMAIL: 58170@bugs.kde.org


  A            png/configure.in.in   1.1
  A            png/kfile_exr.cpp   1.1 [GPL]
  A            png/kfile_exr.desktop   1.1
  A            png/kfile_exr.h   1.1 [GPL]
  M +7 -1      Makefile.am   1.15


--- kdegraphics/kfile-plugins/Makefile.am  #1.14:1.15
@@ -1,6 +1,12 @@
+if include_EXR_MODULES
+KFILE_EXR_SUBDIR=exr
+endif
+
 if include_TIFF
 KFILE_TIFF_SUBDIR=tiff
 endif
 
-SUBDIRS=dvi pdf png ps jpeg xbm bmp tga ico pcx $(KFILE_TIFF_SUBDIR) pnm
+
+SUBDIRS=dvi pdf png ps jpeg xbm bmp tga ico pcx $(KFILE_TIFF_SUBDIR) pnm \
+        $(KFILE_EXR_SUBDIR)
 # gif


Comment 12 Jamo 2004-02-18 09:17:34 UTC
Absolutely great work. :) Hopefully we will see this in KDE 3.3. :)