Loud ramblings of a Software Artisan

Thursday 16 June 2005

dcraw usage

Tor, what dcoffin said about using dcraw in our code is:

  • call the binary in a pipe as it outputs PPM data
  • call the main() function from dcraw as he says:

Also, don't throw away my main() function -- it's full of important logic. Rename it and call it with an argv list.

  • use C++ and cpp

C++ can help here. Take dcraw.c, wrap the globals in a "class DCRaw { }" declaration, add "#define CLASS DCRaw::", and you're almost done.

As far as we are concerned, none of the 3 methods allow getting metadata as the blob are extracted by parse.c, a separate program, which could get some code from the previous.

Third party programs probably use one of the last 2 methods, and resync dcraw code on a regular basis. Given the release cycle of these programs, it not a big issue. Adobe Photoshop is know to provide its own conversion methods, so they only use dcraw to decode. It is something not really well known, but something that Dave Coffin makes a living of.

When it comes to free software, UFRaw includes a now outdated version of the source code (haven't checked CVS and suspect it gets updated), and GNOME raw thumbnailer does the same with parce.c. That exhibit the real need for this library.

Need for a real library for photo decoding and processing

There is a real need for a library to provide decoding and processing, in the Free Software world. Ideally, it would just use the documentation provided by the manufacturers, but since they don't want, reverse engineering will come to the rescue. Still time to Act Now, but lest prepare plan B that can switch back to plan A.

Here is what I see is needed:

  • dcraw functionnality for image processing
  • meta data and MakerNote extraction from the RAW files
  • output all the meta data in a portable way like XMP
  • output either decoded or RAW data
  • all of this in a usable C API (bindable to other language)

How can we achieve that:

  • rip off dcraw code as its license allow
  • use libexif (that needs to be fixed) to decode meta data and MakerNote, or any other apropriate library like the Perl ExifTool
  • implement DNG encoding and decoding
  • implement the missing bits like XMP

We have seen nice things in that area, and I just find that there is not enough focusing. For example Udi Fuchs, UFRaw author, wants to decode the meta data from RAW files using libexif, it is a good oportunity to put that in a library. No doubt, that will be code to reuse. UFRaw already includes the code from dcraw, why not make it a library, since Dave Coffin, from the mail exchange we have had, is not interested in at all. Apparently Udi does not want to reinvent the wheel. All of this would be a good starting point.

At GUADEC, we also had a demo of an ongoing work by Raphael Quinet, towards adding meta data support into the Gimp. If only we could share the effort....