Page 1 of 2

Conversion from .CR2 or .NEF to .JPG completely removes EXIF

Posted: 2009-08-09T20:44:20-07:00
by kolRn
I use cli version of ImageMagick. My task is to convert raw images (for instance .CR2, .NEF) to .JPG and the result file should keep the parent's EXIF tags. But, for some reason, the EXIF tags are removed.

I use this command:

$ convert source.cr2 result.jpg

As I understand, conversion is done by means of ufraw, maybe I need to specify some options in order to get the proper result?

P.S. ImageMagick is a real nice tool, thanks guys who develop it!

Re: Conversion from .CR2 or .NEF to .JPG completely removes EXIF

Posted: 2009-08-10T05:44:05-07:00
by magick
This problem was reported previously. We have a patch in ImageMagick 6.5.4-10, the latest release.

Re: Conversion from .CR2 or .NEF to .JPG completely removes EXIF

Posted: 2009-08-10T22:19:29-07:00
by kolRn
Thanks for so quick reply! I will try to install the latest release!

Re: Conversion from .CR2 or .NEF to .JPG completely removes EXIF

Posted: 2009-08-11T21:54:32-07:00
by kolRn
The latest version installed, but I've encountered the following issue - I use Imagick php extension to convert from RAW into JPEG. Here is my code:

Code: Select all

$im = new Imagick( '/var/tmp/source.CR2' );
$im->setImageFormat( 'jpg' );
$im->writeImage( '/var/tmp/result.jpg' );
$im->clear();
$im->destroy();
The thing is the result image does not have EXIF tags at all, nothing changed after version update.
But! If I carry out convertion from console by typing:

Code: Select all

convert /var/tmp/source.CR2 /var/tmp/result.jpg
then the result image has EXIF tags!

I wonder why is that? Maybe php extension is incompatible in some way with the latest version of imagemagick?

When I resample JPEG image with EXIF-tags by the following code:

Code: Select all

$im->readImage( 'test.jpg' );
$im->scaleImage( 800, 600, true );
$im->writeImage( 'test_resampled.jpg' );
$im->clear();
$im->destroy();
the result image keeps the parent's EXIF tags, all is fine!

Weird.

Thanks in advance,
Nick.

Re: Conversion from .CR2 or .NEF to .JPG completely removes EXIF

Posted: 2009-08-11T22:34:55-07:00
by fmw42
probably need to report the problem to the Imagick developer. he needs to make the upgrade. see the Imagick forum viewforum.php?f=18

Re: Conversion from .CR2 or .NEF to .JPG completely removes EXIF

Posted: 2009-11-26T19:30:43-07:00
by alvgarc
Hi:

I'm facing same problem, even working on last version for windows ImageMagick 6.5.8-0 2009-11-22 Q16.

I don't have the exif data from my .cr2 to .jpeg. Also, converting from .cr2 to .jpg always reproduce a dark jpg if you compare it with the thumbnail image of the CR2.

Here you have one example:

1) The original .cr2 : IMG_7380.CR2 -> http://ul.to/hhz376

2) The Jpeg created by the camera: IMG_7380.JPG -> http://ul.to/djtq71

3) The one from convert: (convert -quality 100 IMG_7380.CR2 IMG_7380_convert.JPG) -> http://ul.to/4m2fkr

Thanks for your feedback

Re: Conversion from .CR2 or .NEF to .JPG completely removes EXIF

Posted: 2009-11-27T04:02:43-07:00
by alvgarc
Hi:

Also I appreciated so much any clue about how to sharpen a bit the images than comes from the raw file. My Canon 350D has a known problem with the sharp of the images.

I've tried +antialias option (no aparent good results) and -sharpen (no idea about how much to apply)

Thanks

Re: Conversion from .CR2 or .NEF to .JPG completely removes EXIF

Posted: 2009-11-28T12:30:48-07:00
by fmw42
try reading the input before setting the output quality

convert IMG_7380.CR2 -quality 100 IMG_7380_convert.JPG

see http://www.imagemagick.org/Usage/basics/#cmdline


for -sharpen see http://www.imagemagick.org/script/comma ... hp#sharpen

set radius=0 and sigma=3 sharpening distance you want in pixels, larger sigma is more sharpening and will depend upon the size of your image and amount of detail

try

-sharpen 0x1 or -sharpen 0x3 etc.

or if using Linus or Mac OSX, you can try some of my sharpening scripts - see link below

Re: Conversion from .CR2 or .NEF to .JPG completely removes EXIF

Posted: 2009-11-28T14:30:35-07:00
by alvgarc
Hi:

Thanks a lot for your replay.

Tried convert IMG_7380.CR2 -quality 100 IMG_7380_convert.JPG but:

1) The exif data from .CR2 hasn't been copied to .Jpg
2) The conversion is still dark

Thanks a lot for any help

Alvaro

Re: Conversion from .CR2 or .NEF to .JPG completely removes EXIF

Posted: 2009-11-28T16:47:49-07:00
by fmw42
Sorry I know nothing about CR2 format data. Perhaps you would post a link to a small example image that has your problems so others, esp the IM folks can review your problem and the image.

Raw formats may have built in lookup tables or log transformations that IM may not know about. What tool do you use normally to read them and get outputs the way you want them to look?

Re: Conversion from .CR2 or .NEF to .JPG completely removes EXIF

Posted: 2009-11-28T17:50:25-07:00
by alvgarc
Hi:

Thanks again for your reply.

For the exif, I've finally goal it using exiftool.

I'll create a post for the dark CR2 conversion.

Alvaro

Re: Conversion from .CR2 or .NEF to .JPG completely removes EXIF

Posted: 2009-11-29T18:19:35-07:00
by anthony
kolRn wrote:The thing is the result image does not have EXIF tags at all, nothing changed after version update.
But! If I carry out convertion from console by typing:

Code: Select all

convert /var/tmp/source.CR2 /var/tmp/result.jpg
then the result image has EXIF tags!

I wonder why is that? Maybe php extension is incompatible in some way with the latest version of imagemagick?
The PHP probably is not using the just installed IM library, and may need to be re-compiled to use that library.

The alternative is to call the IM commands (it will be slower) from the PHP instead of using the PHP imagick library.

Re: Conversion from .CR2 or .NEF to .JPG completely removes

Posted: 2010-10-27T08:40:45-07:00
by TechnoPhil
Hi there,
i installed last version of ImageMagik and i'm trying to convert my canon eos 5d mark 2 raw files (.CR2) to jpeg.
I'm surprised but it is not possible!

How can i do that? also i want to mantein all the EXIF data.

Thanks

Filippo

Re: Conversion from .CR2 or .NEF to .JPG completely removes

Posted: 2010-10-27T09:01:08-07:00
by Bonzo
You can convert from CR2 to RAW but the output varies: viewtopic.php?f=1&t=15974&hilit=cr2

As for the EXIF data it looks like it gets lost.

Re: Conversion from .CR2 or .NEF to .JPG completely removes

Posted: 2010-10-27T09:40:04-07:00
by TechnoPhil
Not possible? are you shure? I can't believe... :(
Anyway what can you suggest me?
I need to process and convert my RAW files, whithout using a grafical program, so i have to use the terminal of my mac os 10.6.4

Filippo