Time to be with your loved ones

Time to be with loved ones

by sat

submit your photo

Hall of Fame
View past winners from this year

Please participate in Meta
and help us grow.

Take the 2-minute tour ×
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It's 100% free, no registration required.

I am a little familiar with tools like dcraw or libraw. I know that we can give one RAW image to each of these tools, and they will give us output image, which is gone through a pipeline procedure:

Now assume that I have the output image after one of the steps in the pipeline. How can I perform the rest of the pipeline using dcraw or libraw(or something else) on that image? For example, I have demosaiced a RAW image (let's say I have done that with another demosaiking tool that I have developed). How can I perform the rest of the pipeline, given that I know the meta data (Like type of the camera, etc.)?

The reason for asking is that, I want to change some of the steps in the pipeline and see the change in the final results of the pipeline. As another example:

Assume this imaginary pipeline in one imaginary software:

RAW -> Demosaicking -> Gamma correction -> color balancing -> 8/16 bit output color image

Let's say I have designed a modified Gamma correction algorithm, and I wanna test it in the pipleline. So I do:

RAW -> Demosaicking -> out1

And apply my algorithm on out1. Then given the result to:

color balancing -> 8/16 bit output color image

Can I do such a thing in one of the current tools?

share|improve this question
If this is asking from a software development standpoint, it should really be migrated to StackOverflow. –  jrista Jun 7 '13 at 15:57
That pipeline IS effectively what current RAW editors, such as Lightroom, Aperture, etc. already DO. You yourself don't need to do that...its handled for you (along with a hundred other things in a much more extensive pipeline.) –  jrista Jun 7 '13 at 16:17
You are assuming some standard intermediate representation/data structure across varying tools. That isn't necessarily that case (even within the same tool the colour space may vary for different processes). Again, this is a software development question, not a photography question. –  user2719 Jun 7 '13 at 16:44
I think probably the best thing to do here is get the Darktable source code and take a look how how its raw processing pipeline works. –  mattdm Jun 7 '13 at 17:00
@Daniel: If you wish to change steps in "the pipeline" (which, btw, is not some universally constant thing...RAW processing pipelines differ for each program, even those that wrap dcraw), then you are really asking a programming question. I think this question should be migrated to StackOverflow, where you can get some help from actual programmers who know dcraw. You might also want to look to dcraws online community, as that is a very extensible RAW processing engine that is used by many editors, and you should be able to hook into its pipeline. –  jrista Jun 7 '13 at 17:02
show 5 more comments

closed as off topic by Stan Rogers, coneslayer, Paul Cezanne, MikeW, John Cavan Jun 10 '13 at 3:40

Questions on Photography Stack Exchange are expected to relate to photography within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers

Well, if you dont want to reprogram dcraw, you can use it or a GUI version of it like my Image View Plus More 3 and set the parameters in the last steps such that they have no effect. Here I set toe = 0 gamma = 1, colourspace = raw, white balance = 1, 1, 1, and highlights = keep.

raw step

And the result:


Which can then be saved as 16bit png, or 16bit ppm or 16bit tif.

save 16bit

Or you can do your own clipping, balancing, gamma curve, etc.:


share|improve this answer
add comment

If I understand your question correctly, you are asking how you can use one existing tool to do certain steps to the RAW image, and then use another existing tool to apply other steps to the modified RAW image before it is converted to another format.

The short answer is, "You can't". This is because the nature of how a RAW image is demosaiced means many of the "steps" you perform on the image are all applied at the same time when the image is converted at the end of the process. Remember that what you are viewing on your screen as you work with the image is not the RAW file itself, but an 8-bit demosaicing of the image that has been revised after each change you make to the settings of the application you are using. When you convert and save at the end of that process, the steps you have applied to the RAW data are "baked in" to the output image.

What you can do with many RAW convertors is select to save the output as a 16-bit TIFF. While this will still "bake in" exposure, WB, contrast, etc., it will do so while discarding less of the information of the original RAW file. This will allow you to import the 16-bit TIFF into another tool and continue working on the image.

share|improve this answer
No, I don't agree with "all applied at the same time". They are being applied sequentially. Now assume this imaginary pipeline in one imaginary software : RAW -> Demosaicking -> Gamma correction -> color balancing -> 8/16 bit output color image Let's say I have designed a modified Gamma correction algorithm, and I wanna test it in the pipleline. So I do: RAW -> Demosaicking -> out1 And apply my algorithm on out1. Then given the result to: color balancing -> 8/16 bit output color image Can I do such a thing? –  Daniel Jun 7 '13 at 17:18
You are selecting the settings separately, but each time you change the settings, the application is going back to the RAW data and re-converting it to what you see on the screen with the most recent as well as all previous changes applied to the RAW file. For any adjustment that affects how the RAW data is demosaiced, the application is not just applying the most recent change you made to what was appearing on your screen just prior to the last adjustment. It is going back and demosaicing the RAW data again with all of your cumulative changes applied. –  Michael Clark Jun 7 '13 at 18:22
That is why you have much more latitude when working with a RAW file to change color balancing, gamma correction, etc. in a non-destructive way: Because the application goes back and applies the settings you have selected to all of the information in the original RAW file before it discards any information. While it is possible to adjust color balance, gamma, etc. to an 8-bit JPEG, you are not able to restore the information discarded in the previous demosaicing/conversion process. –  Michael Clark Jun 7 '13 at 18:26
@MichaelClark I don't think Daniel is envisioning an interactive tool like Lightroom where you're tinkering with settings and watching the results, but something like dcraw. He wants to get to the intermediate steps in the internal pipeline. –  coneslayer Jun 7 '13 at 18:31
Yes. He has modified the question significantly since this answer was written. –  Michael Clark Jun 7 '13 at 18:50
show 1 more comment

I think this should be moved to Stackoverflow.

You can solve this problem. There is a clear indication that Libraw provides a good entry point. You can download additional demoisaicing methods here. So you could tap into that.

However, you probably have to do a bit of programming yourself, therefore this should be moved to StackOverflow.

Here is a starter: Readme.

share|improve this answer
add comment

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