The Reader plugin opens digital camera raw images using DCRAW program created by David Coffin. Raw rormats for over 500 cameras are supported. Full list can be found at dcraw home page.
You can control how raw or how processed the opened image is. This enables extracting sensor data that is lost when image is converted to standard viewing format. You can chose to concentrate, for instance, on image analysis rather than on making an eye-pleasing picture.
The Reader requires the dcraw binary specific to an operating system. Versions for Linux and Windows are part of the distribution. Version for Mac OS X is available through dcraw home page.
DCRaw Reader - Opens over 200 formats digital camera raw images. It is a wrapper for dcraw executable. In a background a raw image is converted to PNM image and the read into ImageJ. Located under Plugins/Image IO.
About DCRaw Reader - Shows brief info about the RCRaw Reader plugin. Located under ImageJ menu Help/About Plugins.
//Get File Directory and file names dirSrc = getDirectory("Select Input Directory"); dirDest = getDirectory("Select Output Directory"); fileList = getFileList(dirSrc); caption = "dcraw batch converter"; print(caption + " - Starting"); print("Reading from : " + dirSrc); print("Writing to : " + dirDest); // Create output directory File.makeDirectory(dirDest); setBatchMode(true); fileNumber = 0; while (fileNumber < fileList.length) { id = fileList[fileNumber++]; print(toString(fileNumber) + "/" + toString(fileList.length) + ": " + id); // Read input image run("DCRaw Reader...", "open=" + dirSrc + id + " " + "use_temporary_directory " + "white_balance=[Camera white balance] " + // "do_not_automatically_brighten " + "output_colorspace=[raw] " + // "document_mode " + // "document_mode_without_scaling " + "read_as=[8-bit] " + "interpolation=[High-speed, low-quality bilinear] " + // "half_size " + // "do_not_rotate " + // "show_metadata" + ""); idSrc = getImageID(); // Save result saveAs("Tiff", dirDest + id); // Cleanup if (isOpen(idSrc)) { selectImage(idSrc); close(); } } print(caption + " - Completed");
// Input file final File inFile = new File("test/data/IMG_5604.CR2"); // dcraw wrapper final DCRawReader dcRawReader = new DCRawReader(); // Listen to output messages dcRawReader.addLogListener(new DCRawReader.LogListener() { @Override public void log(String message) { System.out.println("message = " + message); } }); // Execute dcraw dcRawReader.executeCommand(new String[]{ "-v", // Print verbose messages "-w", // Use camera white balance, if possible "-T", // Write TIFF instead of PPM "-j", // Don't stretch or rotate raw pixels "-W", // Don't automatically brighten the image inFile.getAbsolutePath()}); // Cleanup dcRawReader.removeAllLogListeners(); // Load converted file, it is the same location as original raw file but with extension '.tiff' final ImagePlus imp = IJ.openImage("test/data/IMG_5604.tiff");
Latest version ij-DCRaw plugin, including binaries for Windows and Linux, can be downloaded here.
Plugins are distributed in file ij-dcraw_.jar available in ij-dcraw package at: http://ij-plugins.sourceforge.net/.
Plugins are installed by simply coping the ij-dcraw_.jar to ImageJ plugins directory. The plugins are available under Plugins/Image IO menu, brief help for each plugin is available under Help/About Plugins menu.
By default, the Reader looks for the dcraw binary in subdirectory dcraw of ImageJ plugins folder. An alternative location can be specified by adding property ".dcrawExecutable.path"' to ImageJ properties file IJ_Props.txt located in ImageJ home directory. Here is an example:
Example: IJ_Props.txt
.dcrawExecutable.path=/apps/dcraw/dcraw.exe
Note period at the beginning of property name, it is required by ImageJ.
Reading of 48 bit RGB images requires ImageJ v.1.35p or newer. Earlier versions of ImageJ will support only regular 24 bit RGB images.
Java 6 or better.
dcraw executable (see Installation section for more details).