JPG Created from RAW File is dark

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG Created from RAW File is dark

Post by fmw42 »

Snibgo,

Just curious, does IM on Windows use dcraw or ufraw for the delegates.xml file for DNG?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG Created from RAW File is dark

Post by fmw42 »

Using --exposure=auto in ufraw, seems to brighten the image so as to be similar to what you have. There may be other things done in PS or your camera to create the preview image, such as using whitebalance or some curves or other things. There is a lot that can be used in ufraw:

Code: Select all

ufraw --help
UFRaw 0.22 - Unidentified Flying Raw converter for digital camera images.

Usage: ufraw [ options ... ] [ raw-image-files ... ]
       ufraw-batch [ options ... ] [ raw-image-files ... ]
       ufraw [ options ... ] [ default-directory ]

By default 'ufraw' displays a preview window for each raw image allowing
the user to tweak the image parameters before saving. If no raw images
are given at the command line, UFRaw will display a file chooser dialog.
To process the images with no questions asked (and no preview) use
'ufraw-batch'.

The input files can be either raw images or ufraw's ID files. ID files
contain a raw image filename and the parameters for handling the image.
One can also use an ID file with the option:

--conf=ID-file        Apply the parameters in ID-file to other raw images.

The rest of the options are separated into two groups.
The options which are related to the image manipulation are:

--wb=camera|auto      White balance setting.
--temperature=TEMP    Color temperature in Kelvin.
--green=GREEN         Green color normalization.
--base-curve=manual|linear|camera|custom|CURVE
                      Type of base tone curve to use. CURVE can be any
                      curve that was previously loaded in the GUI.
                      (default camera if such exists, linear otherwise).
--base-curve-file=file
                      Use base tone curve included in specified file.
                      Overrides --base-curve option.
--curve=manual|linear|CURVE
                      Type of luminosity curve to use. CURVE can be any
                      curve that was previously loaded in the GUI.
                      (default linear).
--curve-file=file     Use luminosity curve included in specified file.
                      Overrides --curve option.
--restore=clip|lch|hsv
                      Restore details for negative EV.
                      'clip' restores nothing - safe from artifacts.
                      'lch' restores in LCH space - giving soft details.
                      'hsv' restores in HSV space - giving sharp details.
                      (default lch).
--clip=digital|film   Clip highlights for positive EV.
                      'digital' linear digital sensor response.
                      'film' emulate soft film response. (default digital).
--gamma=GAMMA         Gamma adjustment of the base curve (default 0.45).
--linearity=LINEARITY Linearity of the base curve (default 0.10).
--contrast=CONT       Contrast adjustment (default 1.0).
--saturation=SAT      Saturation adjustment (default 1.0, 0 for B&W output).
--wavelet-denoising-threshold=THRESHOLD
                      Wavelet denoising threshold (default 0.0).
--hotpixel-sensitivity=VALUE
                      Sensitivity for detecting and shaving hot pixels (default 0.0).
--exposure=auto|EXPOSURE
                      Auto exposure or exposure correction in EV (default 0).
--black-point=auto|BLACK
                      Auto black-point or black-point value (default 0).
--interpolation=ahd|vng|four-color|ppg|bilinear
                      Interpolation algorithm to use (default ahd).
--color-smoothing     Apply color smoothing.
--grayscale=none|lightness|luminance|value|mixer
                      Grayscale conversion algorithm to use (default none).
--grayscale-mixer=RED,GREEN,BLUE
                      Grayscale mixer values to use (default 1,1,1).

The options which are related to the final output are:

--shrink=FACTOR       Shrink the image by FACTOR (default 1).
--size=SIZE           Downsize max(height,width) to SIZE.
--out-type=ppm|tiff|tif|png|jpeg|jpg|fits
                      Output file format (default ppm).
--out-depth=8|16      Output bit depth per channel (default 8).
--create-id=no|also|only
                      Create no|also|only ID file (default no).
--compression=VALUE   JPEG compression (0-100, default 85).
--[no]exif            Embed EXIF in output (default embed EXIF).
--[no]zip             Enable [disable] TIFF zip compression (default nozip).
--embedded-image      Extract the preview image embedded in the raw file
                      instead of converting the raw image. This option
                      is only valid with 'ufraw-batch'.
--rotate=camera|ANGLE|no
                      Rotate image to camera's setting, by ANGLE degrees
                      clockwise, or do not rotate the image (default camera).
--crop-(left|right|top|bottom)=PIXELS
                      Crop the output to the given pixel range, relative to the
                      raw image after rotation but before any scaling.
--auto-crop           Crop the output automatically.
--aspect-ratio X:Y    Set crop area aspect ratio.
--lensfun=none|auto   Do not apply lens correction or try to apply
                      correction by auto-detecting the lens (default auto).
--out-path=PATH       PATH for output file (default use input file's path).
--output=FILE         Output file name, use '-' to output to stdout.
--darkframe=FILE      Use FILE for raw darkframe subtraction.
--overwrite           Overwrite existing files without asking (default no).
--maximize-window     Force window to be maximized.
--silent              Do not display any messages during conversion. This
                      option is only valid with 'ufraw-batch'.

UFRaw first reads the setting from the resource file $HOME/.ufrawrc.
Then, if an ID file is specified, its setting are read. Next, the setting from
the --conf option are taken, ignoring input/output filenames in the ID file.
Lastly, the options from the command line are set. In batch mode, the second
group of options is NOT read from the resource file.

Last, but not least, --version displays the version number and compilation
options for ufraw and --help displays this help message and exits.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: JPG Created from RAW File is dark

Post by snibgo »

It uses dcraw:

Code: Select all

<delegate decode="dng:decode" stealth="True" command="dcraw.exe -6 -W -O &quot;%u.ppm&quot; &quot;%i&quot;"/>
As shown here, it doesn't use the camera white balance, and doesn't automatically brighten the image. I may have edited it for those settings.

I don't generally use IM to read raw files. I use dcraw directly.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG Created from RAW File is dark

Post by fmw42 »

Using ufraw in interactive mode and just enabling exposure=auto and saving as JPG with quality 85, I can get very very close to matching the NEF raw image preview shown when displaying the .NEF file in Mac Preview. Using IM to compare gives me:

Code: Select all

compare -metric rmse _INT5470.NEF _INT5470.jpg null:
658.031 (0.0100409)

Which is about 1% difference.

So you probably can edit the delegates.xml file for ufraw to add exposure=auto and use IM to process it. Or just use ufraw or ufraw-batch standalone.
dustinw
Posts: 13
Joined: 2017-01-17T10:44:07-07:00
Authentication code: 1151

Re: JPG Created from RAW File is dark

Post by dustinw »

Thank you guys for all your efforts!

@snibgo and @fmw42 setting the -exposure=auto in UFRaw, we are able to get VERY close to the RAW file, like you said. We've updated UFRaw to include that setting for our ResourceSpace setup, and recreated a few of the images to be sure. It looks like all is working well. Again, thank you very much! This has been a learning experience over the last couple of days.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG Created from RAW File is dark

Post by fmw42 »

Some of the difference might be if you used a different JPG quality when saving the file than came from the preview process.
dustinw
Posts: 13
Joined: 2017-01-17T10:44:07-07:00
Authentication code: 1151

Re: JPG Created from RAW File is dark

Post by dustinw »

That's a good tip. We'll experiment with different quality settings and see where we land. Again, thanks for the assist.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: JPG Created from RAW File is dark

Post by fmw42 »

Exporting as png from ufraw and comparing, I get 0.16% difference

Code: Select all

compare -metric rmse _INT5470.NEF _INT5470.png null:
106.457 (0.00162444)
Post Reply