Conversion of CR2 to tif significantly worse than Photoshop

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
aporthog
Posts: 37
Joined: 2012-05-30T08:24:46-07:00
Authentication code: 13

Conversion of CR2 to tif significantly worse than Photoshop

Post by aporthog »

Version: ImageMagick 6.8.6-10 2013-09-17 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib freetype jbig jng jp2 jpeg lcms png ps png tiff webp x xml zlib
OS; Windows 7

When I do a straightforward conversion of a CR2 file to tiff, the quality is very poor:

convert sample.CR2 im_out.tif

When I do the conversion in either Adobe Camera Raw or something like ThumbsPlus, the quality is much better. Why would this be?

Here are some jpeg samples that illustrate the problem

This is the IM version reduced in size and saved as jpeg:

Image

Even with the reduction in size you can see it has a bluish tint compared to the photoshop version here:

Image

Next I've zoomed in on a portion of both images. But it's hard to distinguish the difference in quality. The blue tint is still obvious though:

IM:

Image

Photoshop:

Image

Sorry the original files are so large, but they are linked below. The photoshop versions have a smoother background, the text isn't as fuzzy.

The original CR2 file (27 MB) is here: http://ucblibrary4.berkeley.edu/~apollo ... sample.CR2
The IM uncompressed tiff output (48-bit 121 MB): http://ucblibrary4.berkeley.edu/~apollo ... im_out.tif
The Photoshop version (24-bit 60 MB): http://ucblibrary4.berkeley.edu/~apollo ... ps_out.tif

Could it be photoshop does some corrections by default and IM only does exactly what you tell it?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Conversion of CR2 to tif significantly worse than Photos

Post by Bonzo »

I think Imagemagick uses dcraw these days and you can edit the default options Imagemagick uses in the delegates.xml file on this line:
<delegate decode="dng:decode" stealth="True" command="dcraw.exe -6 -w -O "%u.ppm" "%i""/>

It may be setup more for images rather than what you want?

This website shows the options and you might want to add -d and remove something else - possably a bit of trial and error. You could also add some sharpening to your command.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Conversion of CR2 to tif significantly worse than Photos

Post by snibgo »

aporthog wrote:Could it be photoshop does some corrections by default and IM only does exactly what you tell it?
I haven't looked at your images, but that is almost certainly the issue.

For Nikon NEF files, and I assume Canon CR2 is the same, the raw image contains metadata about camera settings for contrast, saturation, sharpening etc. dcraw ignores all this metadata apart from white balance. IM ignores all this metadata.
snibgo's IM pages: im.snibgo.com
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Conversion of CR2 to tif significantly worse than Photos

Post by snibgo »

For the colour balance, you can tell dcraw to make a certain area into gray, eg:

Code: Select all

dcraw -v -6 -A 2000 2000 1000 1000 -T -O s.tif sample.cr2
This gives you four RGBG parameters that you might use for all images in the same book, for consistency.

For the sharpening, exiftool tells me the camera settings. SceneCaptureType='Standard' and Canon:SharpnessStandard='3'. Compare this to Canon:SharpnessNeutral='0'. So I expect Photoshop is applying some sharpening.
snibgo's IM pages: im.snibgo.com
aporthog
Posts: 37
Joined: 2012-05-30T08:24:46-07:00
Authentication code: 13

Re: Conversion of CR2 to tif significantly worse than Photos

Post by aporthog »

Thanks all for the pointers. I read up some more on dcraw and found some other threads on raw files and IM and it's clear to me now. I have been applying a CLUT to my images as well as other enhancements such as sharpening with good results. Recently a colleague wanted to work with the unenhanced versions of some of my images and we were puzzled why the basic output was so much worse than what Photoshop and other imaging programs performed and now i see the Photoshop versions weren't unenhanced.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Conversion of CR2 to tif significantly worse than Photos

Post by snibgo »

If you really want unenhanced, try this:

Code: Select all

dcraw -v -6 -W -r 1 1 1 1 -g 1 1 -D -d -T -O out.tiff sample.cr2
This is as raw as it gets. No demosaicing, no correction for the different sensitivities of the RGB sensors, no gamma, no nothing. Just the raw linear sensor data.

See if your colleague is happy with that!
snibgo's IM pages: im.snibgo.com
Post Reply