RAW support

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?".
Post Reply
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

RAW support

Post by GreenKoopa »

I have a raw image file (.arw) from a Sony Alpha NEX 6 camera. IM can read the file, but it gets the raw, uncorrected image. Using a driver from Sony, Windows Explorer displays the file properly. Can IM be made to read through the Sony driver?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: RAW support

Post by snibgo »

IM decodes camera raw images with dcraw. According to http://www.cybercom.net/~dcoffin/dcraw/, Sony NEX-6 is on the list. "convert -list format" includes "arw". So "convert -verbose x.arw x.tiff" should work.

If it doesn't, I suggest you try running dcraw directly and see if that works.
snibgo's IM pages: im.snibgo.com
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: RAW support

Post by GreenKoopa »

This Christmas was my first attempt to shoot in RAW with my new camera, so I am on entirely new ground.

IM does successfully read the file. But I don't want the raw image. Sony embeds color and geometry correction data within the file, and I want it to be applied. I'll guess that dcraw can't do this and that the Sony RAW driver for Windows would be required as a delegate.

My understanding is that Sony's raw .arw file contains:
  • the raw sensor data
  • camera settings, used for color correction and noise reduction
  • lens information, used for geometric correction
  • a jpeg thumbnail, developed using the above
IM, using dcraw, does produce an image using the sensor data. On the other hand, Windows Explorer displays the same corrected image that is seen on the camera's LCD. I don't know if it is generating the image via Sony's RAW driver or is simply showing an embedded jpeg. If it is generating it, I was wondering if IM could use the driver too? My other option is to use Sony's Image Data Converter application to generate tif files. Unfortunately this application can't be used on the command line, and the generated tif files are 96MB each.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: RAW support

Post by snibgo »

dcraw takes the sensor values and converts them to RGB pixels. It can do white balance and noise reduction and chromatic aberration. It doesn't (as I understand it) correct barrel/pincushion, or apply manufacturer-specific special effects that you may have set in your camera, or use any lens-specific information.

A developer would need to comment on the feasibility of calling Sony's driver. I suspect the answer would be, "We are too busy but anyone is free to contribute code."
snibgo's IM pages: im.snibgo.com
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: RAW support

Post by GreenKoopa »

I wouldn't expect IM developers to care specifically about Sony's driver. I just didn't know if there was a Microsoft COM framework or something to provide a common interface for images, like DirectShow is for audio and video codecs. It's all new to me, and probably over my head.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: RAW support

Post by snibgo »

MS has a Windows Imaging Component (WIC) which can read and process some raw camera formats. I have played with it, but only to the extent of changing camera settings, taking photographs and downloading them. See http://msdn.microsoft.com/en-us/library ... 85%29.aspx
snibgo's IM pages: im.snibgo.com
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: RAW support

Post by GreenKoopa »

Yes, like that! I don't know if WIC is widely supported, but a generic connector like WIC is definitely better to support.

Using ExifTool, I learned that my Sony file contains both a 160x120 thumbnail and a 1616x1080 preview jpeg. Maybe Windows Explorer simply uses the preview image?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: RAW support

Post by Bonzo »

Maybe Windows Explorer simply uses the preview image?
When I open my Canon RAW files with Windows picture viewer they jump after a second or so and the quality looks better - I think in this case Windows is using the original RAW file and then adding some corrections. I have a Canon codec installed from the Canon website which may be what Windows is using.
From memory Windows uses the small generated thumbnail when displaying the lists of thumbnails in the folder; as a member on a different forum had a corrupted Large file but the thumbnail was displayed OK. I use Imagemagick to extract the small thumbnail as it was a photo he didn't want to lose.
IM can read the file, but it gets the raw, uncorrected image.
The RAW image is what it is raw; data from the sensor and there should be no correction. Any correction is added to a jpg file if you save a jpg along with the RAW file.
In Lightroom any modifications are added to an XMP file and only applied in lightroom.

In the deligates XML file? there are some default settings that Imagemagick uses to talk to dcraw; I usualy change one of the settings which improves my RAW to jpg conversions. I am at work and can not remember which one; but it is something like a 6 to a 4 or a 4 to a 6.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: RAW support

Post by Bonzo »

I used to change the -6 to -4 on this line but looking at the post below it was for exposure:

Code: Select all

<delegate command="dcraw.exe -6 -w -O "%u.ppm" "%i"" stealth="True" decode="dng:decode"/>
This is the thread on the subject:
viewtopic.php?f=1&t=15974&hilit=dcraw

While in discussion with el_supremo there was another deligate than can be used but I can not find the thread now.
I do all my conversions with a GUI as you can see what you are doing.
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: RAW support

Post by GreenKoopa »

Thanks to all for the input!
Bonzo wrote:In Lightroom any modifications are added to an XMP file and only applied in lightroom.
The Sony version of Lightroom, Image Data Converter\Image Data Converter Ver. 4.0, saves modifications to the raw file itself. That is why I was hoping to choose either the raw or corrected image when opening the file.
Post Reply