Gallery2:Modules:dcraw - Gallery Codex
Personal tools


From Gallery Codex

Dcraw Module

Toolkit to create viewable jpeg version when RAW image formats are uploaded. Requires dcraw external binary.

This is useful for users who do not have shell access. Windows .exe file: (zip)

Source and Windows and Mac OS X binaries can be found here.

Also see: Installing Modules with External Dependencies.

Notes & Gotchas (version 1.0.4)

For those who have version 1.0.4 installed on their galleries and attempt to upload raw digital files like NEF, MRW, CRW, etc. and are unable to access the full sized image, this is because dcraw is pulling the embedded thumbnail in the raw file.


D200 NEF raw file contains a 160x120 JPEG thumbnail embedded in the NEF file. dcraw picks up on this and the dcraw module reports the image's full size to be 160x120.

A workaround to this problem can be accomplished by making the following edit:



Find the lines that look like the following:

           $cmd = array($dcraw, '-c', '-a', '-q', '0', $sourceFilename, '>', $tmpFilename);

           $cmd = array($dcraw, '-c', '-a', '-q', $sourceFilename, '>',

And change it to:

           $cmd = array($dcraw, '-2', '-c', '-a', '-q', '0', $sourceFilename, '>', $tmpFilename);
           $cmd = array($dcraw, '-2', '-c', '-a', '-q', $sourceFilename, '>',

by adding the '-2' to the array definition. This forces the dcraw to parse the true full size of the image submitted.

Note that the '-2' option has been deprecated in some newer versions (8.xx) of dcraw; instead, those newer versions no longer extract the thumbnail from the raw image file by default. Using this option with those newer versions of dcraw would prevent the dcraw module from working correctly. Check for the support of the '-2' option from the command line before applying this change.

The '-2' option may increase the processing time for a particular large raw file or for a particular slow server, so you will want to increase the timelimit for the module:





Might be worthwhile to consider tweaking the dcraw module in the next revision to take the presence of thumbnails into account for size considerations.