Google Site SearchFN Site Search FN Blog Login FN Blog Login
Site Navigation:
 
 

HOWTO: RAW Photo

by Casper Pedersen on September 13, 2004

Being a owner of a digital camera (Nikon D100), and trying to get to the point where I do not use Windows at all - can cause problems. Especially when I once in a while want to shoot in RAW. Then the other day I saw that there now is a program which can convert from RAW to JPG. And a plug-in for The GIMP, with preview, which can use this. But both of these are not distributed with .rpm's.

Here I will give the steps to create .rpm's for these.

  1. Make sure that you have libjpeg-devel and gimp-devel installed:
    [casper@localhost casper]$ su -
    password:
    [root@localhost root]$ yum install gimp-devel
    ....
    [root@localhost root]$ yum install libjpeg-devel
    ....
    
    There might be more dependencies, but these was the once I had to install.
  2. Download dcraw.c from http://www.cybercom.net/~dcoffin/dcraw/ and save it to rpmbuild/SOURCES.
  3. Download rawphoto-20040527.tgz from http://ptj.rozeta.com.pl/Soft/rawphoto and save it to rpmbuild/SOURCES.
  4. Download dcraw.spec and save it to rpmbuild/SPECS
  5. Download gimp-rawphoto.spec and save it to rpmbuild/SPECS
  6. Now build dcraw: Open a terminal and change to your SPECS directory:
    [casper@localhost casper]$ cd rpmbuild/SPECS
    [casper@localhost SPECS]$ rpmbuild -ba dcraw.spec
    [casper@localhost SPECS]$ rpmbuild -ba dcraw.spec
    Executing(%prep): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.34526
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + LANG=C
    + export LANG
    + unset DISPLAY
    + mkdir -p /home/casper/rpmbuild/TMP/dcraw-1.203-1.fdr-root-casper/usr/bin
    + cd /home/casper/rpmbuild/BUILD
    + rm -rf dcraw
    + /bin/mkdir -p dcraw
    + cd dcraw
    ++ /usr/bin/id -u
    + '[' 1000 = 0 ']'
    ++ /usr/bin/id -u
    + '[' 1000 = 0 ']'
    + /bin/chmod -Rf a+rX,u+w,g-w,o-w .
    + exit 0
    Executing(%build): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.34526
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + cd dcraw
    + LANG=C
    + export LANG
    + unset DISPLAY
    + cp -ar /home/casper/rpmbuild/SOURCES/dcraw.c .
    + gcc -o dcraw -O3 dcraw.c -lm -ljpeg
    + exit 0
    Executing(%install): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.41048
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + cd dcraw
    + LANG=C
    + export LANG
    + unset DISPLAY
    + cp dcraw /home/casper/rpmbuild/TMP/dcraw-1.203-1.fdr-root-casper/usr/bin/
    + /usr/lib/rpm/find-debuginfo.sh /home/casper/rpmbuild//BUILD/dcraw
    extracting debug info from /home/casper/rpmbuild/TMP/dcraw-1.203-1.fdr-root-casper/usr/bin/dcraw
    0 blocks
    + /usr/lib/rpm/redhat/brp-compress
    + /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
    + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
    + /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
    Processing files: dcraw-1.203-1.fdr
    Requires(interp): /bin/sh /bin/sh /bin/sh
    Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
    Requires(post): /bin/sh
    Requires(preun): /bin/sh
    Requires(postun): /bin/sh
    Requires: glibc libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1) libc.so.6(GLIBC_2.3) libjpeg libjpeg.so.62 libm.so.6 libm.so.6(GLIBC_2.0)
    Processing files: dcraw-debuginfo-1.203-1.fdr
    Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
    Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/casper/rpmbuild/TMP/dcraw-1.203-1.fdr-root-casper
    Wrote: /home/casper/rpmbuild/SRPMS/dcraw-1.203-1.fdr.src.rpm
    Wrote: /home/casper/rpmbuild/RPMS/i386/dcraw-1.203-1.fdr.i386.rpm
    Wrote: /home/casper/rpmbuild/RPMS/i386/dcraw-debuginfo-1.203-1.fdr.i386.rpm
    Executing(%clean): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.72216
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + cd dcraw
    + rm -rf /home/casper/rpmbuild/TMP/dcraw-1.203-1.fdr-root-casper
    + exit 0
    
  7. Now build gimp-rawphoto:
    [casper@localhost SPECS]$ rpmbuild -ba gimp-rawphoto.spec
    Executing(%prep): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.82205
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + LANG=C
    + export LANG
    + unset DISPLAY
    + mkdir -p /home/casper/rpmbuild/TMP/gimp-rawphoto-0.7-1.fdr-root-casper/usr/lib/gimp/2.0/plug-ins
    + cd /home/casper/rpmbuild/BUILD
    + rm -rf rawphoto-20040527
    + /usr/bin/gzip -dc /home/casper/rpmbuild/SOURCES/rawphoto-20040527.tgz
    + tar -xf -
    + STATUS=0
    + '[' 0 -ne 0 ']'
    + cd rawphoto-20040527
    ++ /usr/bin/id -u
    + '[' 1000 = 0 ']'
    ++ /usr/bin/id -u
    + '[' 1000 = 0 ']'
    + /bin/chmod -Rf a+rX,u+w,g-w,o-w .
    + exit 0
    Executing(%build): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.82205
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + cd rawphoto-20040527
    + LANG=C
    + export LANG
    + unset DISPLAY
    + make
    make[1]: Entering directory `/home/casper/rpmbuild/BUILD/rawphoto-20040527/src'
    gcc -Wall -O0 -g  -c `gimptool --cflags`  rawphoto.c
    rawphoto.c: In function `load_image':
    rawphoto.c:479: warning: implicit declaration of function `swab'
    gcc -Wall -g -o ./rawphoto rawphoto.o `gimptool --libs` `gtk-config --libs`
    make[1]: Leaving directory `/home/casper/rpmbuild/BUILD/rawphoto-20040527/src'
    + exit 0
    Executing(%install): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.49770
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + cd rawphoto-20040527
    + LANG=C
    + export LANG
    + unset DISPLAY
    + cp src/rawphoto /home/casper/rpmbuild/TMP/gimp-rawphoto-0.7-1.fdr-root-casper/usr/lib/gimp/2.0/plug-ins/
    + /usr/lib/rpm/find-debuginfo.sh /home/casper/rpmbuild//BUILD/rawphoto-20040527
    extracting debug info from /home/casper/rpmbuild/TMP/gimp-rawphoto-0.7-1.fdr-root-casper/usr/lib/gimp/2.0/plug-ins/rawphoto
    0 blocks
    + /usr/lib/rpm/redhat/brp-compress
    + /usr/lib/rpm/redhat/brp-strip /usr/bin/strip
    + /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
    + /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
    Processing files: gimp-rawphoto-0.7-1.fdr
    Executing(%doc): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.35082
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + cd rawphoto-20040527
    + DOCDIR=/home/casper/rpmbuild/TMP/gimp-rawphoto-0.7-1.fdr-root-casper/usr/share/doc/gimp-rawphoto-0.7
    + export DOCDIR
    + rm -rf /home/casper/rpmbuild/TMP/gimp-rawphoto-0.7-1.fdr-root-casper/usr/share/doc/gimp-rawphoto-0.7
    + /bin/mkdir -p /home/casper/rpmbuild/TMP/gimp-rawphoto-0.7-1.fdr-root-casper/usr/share/doc/gimp-rawphoto-0.7
    + cp -pr README /home/casper/rpmbuild/TMP/gimp-rawphoto-0.7-1.fdr-root-casper/usr/share/doc/gimp-rawphoto-0.7
    + exit 0
    Requires(interp): /bin/sh /bin/sh /bin/sh
    Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
    Requires(post): /bin/sh
    Requires(preun): /bin/sh
    Requires(postun): /bin/sh
    Requires: dcraw gimp >= 2.0 libX11.so.6 libXext.so.6 libXi.so.6 libatk-1.0.so.0 libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1) libdl.so.2 libgdk-1.2.so.0 libgdk-x11-2.0.so.0 libgdk_pixbuf-2.0.so.0 libgimp-2.0.so.0 libgimpbase-2.0.so.0 libgimpcolor-2.0.so.0 libgimpmath-2.0.so.0 libgimpui-2.0.so.0 libgimpwidgets-2.0.so.0 libglib-1.2.so.0 libglib-2.0.so.0 libgmodule-1.2.so.0 libgmodule-2.0.so.0 libgobject-2.0.so.0 libgtk-1.2.so.0 libgtk-x11-2.0.so.0 libm.so.6 libm.so.6(GLIBC_2.0) libpango-1.0.so.0 libpangox-1.0.so.0 libpangoxft-1.0.so.0
    Processing files: gimp-rawphoto-debuginfo-0.7-1.fdr
    Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1
    Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/casper/rpmbuild/TMP/gimp-rawphoto-0.7-1.fdr-root-casper
    Wrote: /home/casper/rpmbuild/SRPMS/gimp-rawphoto-0.7-1.fdr.src.rpm
    Wrote: /home/casper/rpmbuild/RPMS/i386/gimp-rawphoto-0.7-1.fdr.i386.rpm
    Wrote: /home/casper/rpmbuild/RPMS/i386/gimp-rawphoto-debuginfo-0.7-1.fdr.i386.rpm
    Executing(%clean): /bin/sh -e /home/casper/rpmbuild/TMP/rpm-tmp.35082
    + umask 022
    + cd /home/casper/rpmbuild//BUILD
    + cd rawphoto-20040527
    + rm -rf /home/casper/rpmbuild/TMP/gimp-rawphoto-0.7-1.fdr-root-casper
    + exit 0
    
  8. Now install the files:
    [casper@localhost SPECS]$ su
    Password:
    [root@localhost SPECS]# cd ../RPMS/i386/
    [root@localhost i386]# rpm -ivh dcraw-1.203-1.fdr.i386.rpm gimp-rawphoto-0.7-1.fdr.i386.rpm
    Preparing...                ########################################### [100%]
       1:dcraw                  ########################################### [ 50%]
       2:gimp-rawphoto          ########################################### [100%]
    [root@localhost i386]#
    
  9. Now it's time to test it...... Right click on a .nef photo, and select 'Open with' -> 'The GIMP', and you should see

For more inforamtion

Credits goes to
Dave Coffin for dcraw
Pawl T. Jochym for RawPhoto GIMP-2.0 plug-in
And the whole The GIMP team for a great tool.