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.