Ok...I've downloaded LibRaw...and now what?

How do I get this thing work?
What do I do?
It's just a file on my desktop.
I have no clue.


LibRaw is for software developers

LibRaw is for software developers. Many users of digiKam, Krita and some other RAW processing software are happy with these programs (which, in turn, uses LibRaw via libkdcraw).

Anyway, LibRaw distribution includes several command-line tools. Take a look to half_mt utility which is similar to 'dcraw -h', but much faster in batch processing on multi-CPU/multicore machines

-- Alex Tutubalin

Dummy here

I also have absolutely no clue.
I wrote a Microsoft Visual Basic program to select the pictures that I like and the ones that I don't like, and them send all the 'good' ones to my usb key so I take it out to print.
My friend saw my program and asked if I could include the capability to read .raw files in addition to the .jpgs, so I got here. Absolutely no clue.
I understand that this is a library, and my program should include it in the project and then call it. But that's it. Anyone can help?

(I remember the first time I opened the BASIC shell, and I had no idea... a friend sat by my side to teach me and in ten minutes I was programming like crazy... so yeah, it should be easy when someone shows you... but without it...)

Sorry, no ideas on C/C++

Sorry, no ideas on C/C++ library integration with VisualBasic.

-- Alex Tutubalin

About -c stdout command

Just compiled and tried out some different stuff in bin folder. Checked into dcraw_emu and I am used to work with the piping command in dcraw.
-c Write image data to standard output
Is piping working somehow with libraw or what,s the reason it isn,t?

Ok, thanks for answers.

Ok, thanks for answers.
By the way. maybe you can answer. I,ve been exlporing the use of icc profiles in dcraw and also tried this in dcraw_emu. This works with -p [profile.icc] but I never get the colors right. It,s always washed out. Almost like dcraw is defaulting to raw color when using icc profiles? when trying the same profiles in photoshop or lightroom the colors are always right. Would be nice to have your point of view about this issue.
Thanks again.

Yes, I did. It works and

Yes, I did. It works(I think) and applies the icc profile. Gamma is correct but colors are faded.

My output command goes like this
dcraw_emu -T -a -p profile.icc my.dng

My output when running dcraw_emu in terminal looks like this

LibRaw-0.17.2/bin/.libs/dcraw_emu [OPTION]... [FILE]...
-c float-num       Set adjust maximum threshold (default 0.75)
-v        Verbose: print progress messages (repeated -v will add verbosity)
-w        Use camera white balance, if possible
-a        Average the whole image for white balance
-A <x y w h> Average a grey box for white balance
-r <r g b g> Set custom white balance
+M/-M     Use/don't use an embedded color matrix
-C <r b>  Correct chromatic aberration
-P <file> Fix the dead pixels listed in this file
-K <file> Subtract dark frame (16-bit raw PGM)
-k <num>  Set the darkness level
-S <num>  Set the saturation level
-n <num>  Set threshold for wavelet denoising
-H [0-9]  Highlight mode (0=clip, 1=unclip, 2=blend, 3+=rebuild)
-t [0-7]  Flip image (0=none, 3=180, 5=90CCW, 6=90CW)
-o [0-5]  Output colorspace (raw,sRGB,Adobe,Wide,ProPhoto,XYZ)
-o file   Output ICC profile
-p file   Camera input profile (use 'embed' for embedded profile)
-j        Don't stretch or rotate raw pixels
-W        Don't automatically brighten the image
-b <num>  Adjust brightness (default = 1.0)
-q N      Set the interpolation quality:
          0 - linear, 1 - VNG, 2 - PPG, 3 - AHD, 4 - DCB
          5 - modified AHD,6 - AFD (5pass), 7 - VCD, 8 - VCD+AHD, 9 - LMMSE
-h        Half-size color image (twice as fast as "-q 0")
-f        Interpolate RGGB as four colors
-m <num>  Apply a 3x3 median filter to R-G and B-G
-s [0..N-1] Select one raw image from input file
-4        Linear 16-bit, same as "-6 -W -g 1 1
-6        Write 16-bit linear instead of 8-bit with gamma
-g pow ts Set gamma curve to gamma pow and toe slope ts (default = 2.222 4.5)
-T        Write TIFF instead of PPM
-G        Use green_matching() filter
-B <x y w h> use cropbox
-F        Use FILE I/O instead of streambuf API
-timing   Detailed timing report
-fbdd N   0 - disable FBDD noise reduction (default), 1 - light FBDD, 2 - full
-dcbi N   Number of extra DCD iterations (default - 0)
-dcbe     DCB color enhance
-eeci     EECI refine for mixed VCD/AHD (q=8)
-esmed N  Number of edge-sensitive median filter passes (only if q=8)
-acae <r b>Use chromatic aberrations correction
-aline <l> reduction of line noise
-aclean <l c> clean CFA
-agreen <g> equilibrate green
-aexpo <e p> exposure correction
-dbnd <r g b g> debanding
-mmap     Use mmap()-ed buffer instead of plain FILE I/O
-mem	   Use memory buffer instead of FILE I/O
-disars   Do not use RawSpeed library
-disinterp Do not run interpolation step
-dsrawrgb1 Disable YCbCr to RGB conversion for sRAW (Cb/Cr interpolation enabled)
-dsrawrgb2 Disable YCbCr to RGB conversion for sRAW (Cb/Cr interpolation disabled)
-disadcf  Do not use dcraw Foveon code either if compiled with demosaic-pack-GPL2

I am curious if it is

I am curious if it is possible to add any other info to the output such as color space? A bit contradictory since an icc should contain colorspace information one would think?

Sorry, dcraw_emu is 'demo for

Sorry, dcraw_emu is 'demo for library users' (so, for app developers), not for end-user.

It is very limited in functions.

-- Alex Tutubalin

I see. It was worth a try :).

I see. It was worth a try :). For what it,s worth, the same limitations occur in dcraw so I assume the code is coming from there.
Sorry all questions but do you perhaps know a starting point being able to add 1D and/or 3D luts in dcraw/libraw?

Yes, postprocessing code

Yes, postprocessing code (after raw data read/unpack) is completely imported from dcraw without much improvement in functions.

Both 1D and 3D luts looks easy to implement assuming you've working code that replaces pixel value in place.

Assuming you're working in linear space in 'camera color', the best place to implement your code is convert_to_rgb_loop() function. It gets linear profile (out_cam[3][4]) that converts from camera space to output rgb. You may replace it with your code.

This function is already 'virtual', so it is very easy to implement any color conversion in derived class.

-- Alex Tutubalin

Good evening Alex. Would you

Good evening Alex. Would you kindly guide me a few steps forward with your suggestion? In dcraw I find the place where different color space is written. If I want to create something like linear to log, where would I change numbers? Where would I found these figures?
Thanks in advance

float out[3], out_cam[3][4];
  double num, inverse[3][3];
  static const double xyzd50_srgb[3][3] =
  { { 0.436083, 0.385083, 0.143055 },
    { 0.222507, 0.716888, 0.060608 },
    { 0.013930, 0.097097, 0.714022 } };
  static const double rgb_rgb[3][3] =
  { { 1,0,0 }, { 0,1,0 }, { 0,0,1 } };
  static const double adobe_rgb[3][3] =
  { { 0.715146, 0.284856, 0.000000 },
    { 0.000000, 1.000000, 0.000000 },
    { 0.000000, 0.041166, 0.958839 } };
  static const double wide_rgb[3][3] =
  { { 0.593087, 0.404710, 0.002206 },
    { 0.095413, 0.843149, 0.061439 },
    { 0.011621, 0.069091, 0.919288 } };
  static const double prophoto_rgb[3][3] =
  { { 0.529317, 0.330092, 0.140588 },
    { 0.098368, 0.873465, 0.028169 },
    { 0.016879, 0.117663, 0.865457 } };
  static const double aces_rgb[3][3] =
  { { 0.432996, 0.375380, 0.189317 },
    { 0.089427, 0.816523, 0.102989 },
    { 0.019165, 0.118150, 0.941914 } };
  static const double (*out_rgb[])[3] =

convert_to_rgb operates in

convert_to_rgb operates in linear space (from raw color space to linear output).

Final gamma conversion is done in dcraw_make_mem_image() or in dcraw_ppm_tiff_writer() calls

-- Alex Tutubalin