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

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?".
kolRn

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

Post 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!
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

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

Post by magick »

This problem was reported previously. We have a patch in ImageMagick 6.5.4-10, the latest release.
kolRn

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

Post by kolRn »

Thanks for so quick reply! I will try to install the latest release!
kolRn

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

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
alvgarc

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

Post 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
alvgarc

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

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
alvgarc

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

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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?
Last edited by fmw42 on 2009-11-28T21:14:26-07:00, edited 1 time in total.
alvgarc

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

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

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

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
TechnoPhil
Posts: 22
Joined: 2010-10-27T08:21:15-07:00
Authentication code: 8675308
Location: San Marino

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

Post 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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

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

Post 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.
User avatar
TechnoPhil
Posts: 22
Joined: 2010-10-27T08:21:15-07:00
Authentication code: 8675308
Location: San Marino

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

Post 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
Post Reply