I'm looking for Linux software that allows tuning the exposure of the RAW image. I want to make an "auto HDR" script that would change the exposure of the photo automatically and then combine the results into one HDR image.

I know I can certainly use RawTherapee or Darktable to do this, but I'd still prefer a headless way, since I don't wanna rely on GUI if not necessary.

Thanks to anyone who responded or commented. I really appreciate your advice.

  • The idea of RAW files is they are a source. So after changing exposure you should save it as image (RAW is not a image). What is your desirable output format? Dec 4, 2022 at 9:06

1 Answer 1


I've recently been working on something similar. I'm after light tone mapping on the final image. No halo.

Here's what I've got so far:


for file in $@
ufraw-batch "$file" --auto-crop --exposure=-1.5 --output="${file%.nef}-0.ppm"
ufraw-batch "$file" --auto-crop --exposure=auto --output="${file%.nef}-1.ppm"
ufraw-batch "$file" --auto-crop --exposure=+1.5 --output="${file%.nef}-2.ppm"
enfuse "${file%.nef}-0.ppm" "${file%.nef}-1.ppm" "${file%.nef}-2.ppm" --output="${file%.nef}.ppm"
rm "${file%.nef}-0.ppm" "${file%.nef}-1.ppm" "${file%.nef}-2.ppm"
convert-jpeg "${file%.nef}.ppm"
exiftool -overwrite_original -TagsFromFile "${file}" -x Orientation "${file%.nef}.jpg"
jhead -ft "${file%.nef}.jpg"
chmod 644 "${file%.nef}.jpg"
rm "${file%.nef}.ppm"

Basically, ufraw-batch or dcraw to extract a file and adjust its exposure. I haven't figured out how to adjust based on the auto-calculated exposure adjustment, so I just do -1.5, auto, and then 1.5 and it seems to do pretty well.

Then I have a little script that calls imagemagick and converts the final assembled ppm to a jpeg, use exiftool to copy over the exif info, jhead to set file date based on the exif info, and erase the intermediate ppm.


The nice thing is that this does better than the in-camera algorithm in all cases and doesn't look garish and cartoonish.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.