How do I direct dcraw_emu to standard out for writing a jpeg on the fly....?

When using dcraw I could set -c option to direct to stdout as specified at the top of the man page here:

This allowed me to write jpegs or pngs on the fly via the comand line (e.g. something like this:

I've made the move to libraw and love the extra speed and the better results. However at the moment I'm only interacting with it via dcraw_emu and the command line. I see that -c is used for the float value here. So when I try to do something like this:

dcraw_emu -F -v -W -aexpo 1.75 0.0 -c 1 -q 9 -n 50 -m 1 -G -agreen 0.03 -o 4 -aclean 0.01 0.01 -fbdd 1 -timing -T -6 myfile.CR2| cjpeg -quality 100 -optimize -progressive > mynewfile.jpg

I just get an empty file. I've tried adding other switches such as -F (i.e. Use FILE I/O instead of streambuf) and also -T -6 so that output is a 16bit TIFF. I'm pretty sure I must be missing something obvious.

Any help here would be much appreciated as would love to convert on the fly as I did before.


dcraw_emu only writes to

dcraw_emu only writes to files now, so you need to create temporary .tif file

-- Alex Tutubalin @LibRaw LLC

Thanks for replying so

Thanks for replying so quickly Alex.

Can you think of any other ways I could attempt to get around this this with LibRaw? My application is running on a Rasberry Pi 2. Unfortunately my processing pipeline seems to be bottlenecked by the time it takes to write to the Pi's SD card. Despite having the fasted SD card available, writing is quite slow with the Pi 2. With 16bit TIFF's and then having to write out another PNG or JPEG to disk I think the cumulative effect is adding roughly 25-30% extra processing time to each photo.

Since my application converts 100s of pictures per job this can add quite few more minutes for each capture session. Perhaps I need to look in to modifying one of the source code examples and trying to figure out how to modify the code to do this myself. Do you think this would be possible? I'm not an experienced C++ programmer though and so any pointers would be most welcome. If you think it's a non-trivial task then perhaps I'd be best to just live with the extra time this steps takes.


LibRaw::dcraw_ppm_tiff_writer(char* fn) accepts filename as parameter.

It looks like you need to create own image writing code with ability to write to stdout

-- Alex Tutubalin @LibRaw LLC