Saturday, 17 May 2014

DCRAW 9.21 for OS X Mavericks: compiling the program

dcraw is a command line program that can read various proprietary raw files (the list is endless) and convert them into a standard image format (TIFF or PPM). Once I came across this description of the dcraw project: "Dave's mission is to write and maintain an ANSI C program that decodes any raw image from any digital camera on any computer running any operating system”. Very well said.
http://www.cybercom.net/~dcoffin/dcraw/
The program is small, portable and used in many well-known free and commercial products including Adobe Photoshop. Did I say that it's free? Development work was started in 1997 followed by the first release three years later. In 2012 dcraw was the first program that processed Fujifilm x-trans raw files without smearing of fine details ("water colour effect"), here is my short review.  dcraw is also one of the few raw converters that can read and decode Sigma Foveon raw files.

The genius behind dcraw is David Coffin who just released version 9.21 and, as always, the source code is readily available for download. But David provides only the source code, which means for the folks like me "computer mumbo-jumbo that no one can use in real life".  In order to use the program you need an executable file,  the file that is compiled from the source code. Just google and you will easily find the latest dcraw executables for win32/64 systems but not so many (if any) for Mac OS X. Here is what you can do.



If you want to try dcraw on Mac OS X system then you can use one of the following options: download the source code and compile the program yourself (Mac OS X is UNIX after all), download executable from the internet or simply use one of the free front-ends like LightZone or RawTherapee (unfortunately RT 4.0.12.154  crashes on Fuji x-trans raw files at the time of writing this post).

Let's start with the first option. Here is my step by step instructions how to compile dcraw in the Terminal.app on OS X Mavericks 10.9.3
This article is for someone who wants to use original raw converter as it is designed. Although I really doubt that any Mac user would do it let's get started.

1. Create a new folder on your desktop and call it MYDCRAW (the folder location and the name is entirely your choice)

2. Get the original source code by clicking on the link, you should see this in Safari:


Select the entire code (command + a) and copy it (command + c) into the clipboard for now

3. Next, open the TextEdit.app, go to Format and click on Make Plain Text

4. Paste the source code (command + v)


5. Save file as dcraw.c in MYDCRAW folder (or whatever your folder name is). It should be the only file in that folder.

So far so good. Now let's make Terminal a bit more "user friendly" so you can start it in the folder of your choice (where you raw files located) rather then in your home directory only.

6. Open System Preferences, choose Keyboard, then Shortcuts tab. Under the Services  check mark  New Terminal at Folder. Close.


7. Make a right "click" on  MYDCRAW a, go to Services and choose New Terminal at Folder


Now you can start Terminal in any folder, rather then use cd commands to navigate to the required folder.
8. In Terminal type ls and you should see dcraw.c in response

9. Cut/paste command below into the Terminal and hit Enter

llvm-gcc -o dcraw dcraw.c -lm -DNO_JPEG -DNO_LCMS -DNO_JASPER

10. Most likely your Mac will download and install XCode.app and then compile the source. When it is done (don't worry about the warning messages) you can open MYDCRAW folder and find new file: dcraw



11. Go back to the Terminal window, cut/paste command below and  hit Enter

open $home/bin

this command will open a hidden bin folder in GUI mode

12. Drag and drop dcraw (not the dcraw.c) file from MYDCRAW folder into the bin folder.

13. Now, type in Terminal dcraw and if you see this:



then, congratulations, you have successfully compiled the dcraw program and now ready to use it!

In my next article I will explain how to use dcraw as a command line program.

vkphoto


5 comments:

  1. Thanks. I couldn't get it to compile, I think because it was looking for some missing libraries, and I didn't realize I could compile it without those libraries, which is (I guess) what those options you mention do.

    ReplyDelete
    Replies
    1. I am glad it was helpful. vkphoto

      Delete
  2. Thank you so much!

    ReplyDelete
  3. in step #12 i have problem because file don't move in folder

    ReplyDelete
  4. internet recovery how to update efi firmware bios for Mac
    this an answer

    ReplyDelete