For those who want to know: de-noise and develop your raw files from scratch using dcraw, ImageMagick, Photoshop and command-line batch files.

For those who want to know: de-noise and develop your raw files from scratch using dcraw, ImageMagick, Photoshop and command-line batch files.

After 13 years of laziness and complacency, happy with the raw processing software I had, I finally decided it was time to learn how raw files really work, how they are developed, and what was involved in noise removal.

It's mainly about understanding, secondarily about image quality. Although, I imagine that certain tweaks and processes can only be done by hand, and for this, it is necessary to know what's really going on when you "convert" a raw file.

If there is enough interest, I will post this in several separate posts, about 5 or 6 of them are needed to describe everything involved. It is not for the lazy. Also, you will need Photoshop CS2 or newer (available for free if you do some searching, the words "redmondpie", "photoshop", and "legally" come to mind).

Alright, without further ado, this is

Step 1 - convert raw to tiff

You will convert a raw file to a tiff file containing raw sensor values. No color, no gamma curve, not even the full 16-bit value range supported by tiff.

1 Create a directory C:\Program Files\Utilities for command-line utilities like DCRAW.

2 Set Modify permissions to the directory C:\Program Files\Utilities: Right-click on C:\Program Files\Utilities, and choose Properties. Go to Security, click Edit, scroll to Users, click on Users and check the Modify box below, under Allow. Click OK twice.

3 Add C:\Program Files\Utilities to your PATH: Win-key + Pause/Break > Advanced system settings > Environment variables, in the lower section System variables, edit the PATH variable: add C:\Program Files\Utilities to the list, add a ; to separate the paths if needed.

Reboot your computer to make sure the updated PATH variable is active.

4 Download DCRAW 9.27, it supports wildcards. This is important.


5 Place the downloaded dcraw.exe into the directory C:\Program Files\Utilities, which is now easy to do because Modify rights are configured.

6 If you've already got Imagemagick on your computer, go to its directory and delete or rename its dcraw.exe file if there is one there - it's an older version that doesn't support wildcards.

7 Create a dcraw-unprocessed.bat file: Inside C:\Program Files\Utilities, right-click and click on New > Text Document. Type the name


and hit Enter. Watch the file icon change from a sheet of paper to a box with gears. If this doesn't happen, you have hidden file extensions enabled and you need to turn that off (in the Windows Explorer options and settings, under the View tab).

Now right-click on your dcraw-uprocessed.bat file, and click Edit.


dcraw -v -4 -T -D %1

Save the file.

8 Test dcraw: Browse to a directory with raw files, make sure no files are selected, hold down shift, and right-click on an empty area inside the directory. You should see the option "Open command window here".

On the command line, type


and hit Enter. You should see the command line options that are available for dcraw. If not, did you reboot your computer after step 3? Do that and try again.

9 Develop a raw file from the command line: Type the following, replacing filename.ext with whatever your raw file is you want to test:

dcraw-unprocessed filename.ext

and hit Enter. Watch dcraw process the raw file into a grayscale 16-bit tiff file. This should be very fast. Open this file with whatever graphics program you prefer to use. The photo will be very dark because it's made of linear sensor values that haven't been scaled to the 16-bit value range yet. You should be able to recognize the Bayer filter-pattern. Later we'll need Adobe Photoshop CS2 at least, to demosaic and gamma-encode the tiff file.

Comments and questions welcome!

Submitted November 22, 2016 at 07:16PM by TheMerovingian from reddit via /r/astrophotography