June 2017 © Daniel Ljunggren

BREW: Batch REWork.
A workflow for digital raw-image processing in Linux

Here I share a set of command-line tools for automatic high-quality (16-bit) decoding and post-processing of raw-images in Linux/UNIX. These consists of a few bash shell scripts, based on dcraw, ImageMagick, Netpbm, tifficc, exiftool, awk, jhead, qiv, and standard bash-commands.

Each script contains some limited help information (#<script> -help) and are provided "as is".
No guarantees. No complaints.

Typically the workflow is: brewprep → brewraw → brewtool


This is the main script for converting raw-images to jpeg or tiff, while preserving EXIF-tags from the raw-format. The following is performed: decoding with dcraw including noise removal, adjustment of exposure value, application of non-linear curve, histogram normalization, application of colorprofiles, sigmoidal contrast tone-curve, and highlight stretching. NOTE: The file needs to be amended to include the appropriate color-profiles for your camera located in your linux system (/usr/share/color/icc/). (I find the profiles shipped with Capture One for Canon EOS 5D particularly nice for that camera.) If you want to set a color temperature manually you also need WBtoRGGB.table, preferably adapted for your camera.

Depends on brewtool.


# brewraw -tiff -wedding D101010_a1010.cr2


Another main script for various manipulations of image-files. Can be used prepare images for web publishing, change the color profile etc., and copy EXIF-metatags from raw-source file.


# brewtool web -size 800 -tagsraw D101010_a1010_r16.tif


A script for preparing raw-images straight from the camera by extracting a preview image, renaming files based on shooting date and appending the current last number in image-database sequence, and sorting them into directories based on date format YYYY_MM. Files named by the camera as IMG_0001.CR2 ... IMG_0300.CR2 will be renamed and sorted as 2010_10/D101010_c1235.cr2 ... 2010_10/D101010_c1534.cr2 assuming the last image in database was numbered c1234.

Depends on brewpreview, brewrot, brewid, brewbiasnr, brewmv, brewsort.


# brewprep *.CR2


A short script to extract and return the most relevant EXIF-metatags contained in any images.


# brewinfo *.jpg

Created 2006—2018 © by  Daniel Ljunggren < >

Comments (0)

Leave a comment

E-mail (will not be shown)
Prove that you are a human by writing the letters in the box.