CR2 to TIFF Conversion without Color Change

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
mertkucuk
Posts: 3
Joined: 2014-03-19T06:34:29-07:00
Authentication code: 6789

CR2 to TIFF Conversion without Color Change

Post by mertkucuk »

Hi community;

I am trying to convert CR2 file to Tiff without changing the color according to conversion in Adobe Lightroom and Adobe Photoshop.

I am simply read CR2 file and write Tiff file as

convert image.CR2 -profile AdobeRGB.icc -profile AdobeRGB.icc image.tiff

The CR2 File does not have embedded profile but tagged as AdobeRGB. Because of this problem, ImageMagick gives sRGB colorspace when I do not write "-profile AdobeRGB.icc -profile AdobeRGB.icc "

The results are:
Image

My CR2 file is http://speedy.sh/UhE6V/IMG-8042384AdobeRGB.CR2
Convertion result in photoshop is http://speedy.sh/9Nw27/IMG-8042384AdobeRGB.tif
Conversion result of ImageMagick http://speedy.sh/d6KC4/IMG-8042384.tiff

So my question is that how can convert my CR2 file with imageMagick for resulting same image in photoshop.

Note: The embedded Jpeg file in CR2 isalso very close what photoshop converts CR2 in default values.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: CR2 to TIFF Conversion without Color Change

Post by Bonzo »

If you look in delegates.xml there is this line:
<delegate command="dcraw.exe -6 -w -O "%u.ppm" "%i"" stealth="True" decode="dng:decode"/>

I have not converted a CR2 file in Imagemagick for a few years but I seem to remember changing the -6 to a -4 as the output was either to light or to dark.
You can check out the other dcraw options here: http://www.cybercom.net/~dcoffin/dcraw/dcraw.1.html You might have a go at changing the -w to a -a
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: CR2 to TIFF Conversion without Color Change

Post by snibgo »

The link to the CR2 file downloads "IMG_8042384AdobeRGB.CR2.exe", an exe file. When run it, it wants to make changes to my computer, which I won't allow. So I can't test your CR2.
mertkucuk wrote:-profile AdobeRGB.icc -profile AdobeRGB.icc
The first "-profile" will assign a profile, ie embed the icc, without changing pixel values. The second "-profile" should have no effect at all (because it would convert pixel values from AdobeRGB to AdobeRGB).

This would be a reasonable action if your CR2 has pixels in the AdobeRGB colorspace, without the embedded profile.

However, when I run dcraw with "-o 2", it does embed the AdbodeRGB profile.
snibgo's IM pages: im.snibgo.com
mertkucuk
Posts: 3
Joined: 2014-03-19T06:34:29-07:00
Authentication code: 6789

Re: CR2 to TIFF Conversion without Color Change

Post by mertkucuk »

Do not click the download at the down.

You must click the link at the top which is file name.

Sorry for uploading this site.

I think you should scan your computer for any harm.
mertkucuk
Posts: 3
Joined: 2014-03-19T06:34:29-07:00
Authentication code: 6789

Re: CR2 to TIFF Conversion without Color Change

Post by mertkucuk »

CR2 files can't has really profile file because it is raw sensor signals.

So the embedded profile of it, is the embedded jpeg file and shot information.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: CR2 to TIFF Conversion without Color Change

Post by snibgo »

I am more familiar with Nikon NEF raw files than Canon CR2, but I assume they work in the same way.

A raw file contains the values from the camera sensor, which records linear levels. Some pixels represent red values, some are green, and the rest are blue. dcraw interpolates so that each pixel contains red, green and blue values, and also converts from linear to some other colorspace: default is sRGB, but can be AbobeRGB etc.

The raw file will contain a flag that says what colorspace the photographer wants for the output. But I believe dcraw ignores this flag.

If you want the output to be AbobeRGB you can either run dcraw with "-o 2", or leave dcraw to do its default action, and use IM to change colorspace with "-profile sRGB.icc -profile AdobeRGB.icc". (This assumes both ICC files are in your current directory.) The first "-profile" embeds sRGB; the second converts pixels to AdobeRGB and replaces the embedded sRGB profile with the AdobeRGB profile.

For example:

Code: Select all

F:\web\im>%IM%convert -verbose IMG_8042384AdobeRGB.CR2 -profile sRGB.icc -profile AdobeRGB1998.icc acr2.png

dcraw.exe -6 -w -O "C:/Users/Alan/AppData/Local/Temp/magick-5800-YWFgErLFM8z.ppm" "C:/Users/Alan/AppData/Local/Temp/magick-5800mVeEMVnuMMT9"
Instead, I can use standalone dcraw to directly create a tiff file, in AdobeRGB, with embedded profile:

Code: Select all

dcraw -o 2 -w -O xcr2.tiff -6 -T IMG_8042384AdobeRGB.CR2
The results are not exactly the same. Most of the difference is due to differences in profiles. If I tell convert to use the exact profiles that dcraw uses...

Code: Select all

convert -verbose IMG_8042384AdobeRGB.CR2 -profile dcrSRGB.icc -profile dcrAdobeRGB.icc acr2.png
... the results are visualy identical, and "compare" reports a difference of 0.00968372, ie 0.9%.
snibgo's IM pages: im.snibgo.com
Post Reply