[KPhotoAlbum] Importing Canon raw files
Robert L Krawitz
rlk at alum.mit.edu
Tue May 9 23:19:13 BST 2006
From: Shawn Willden <shawn-kimdaba at willden.org>
Date: Tue, 9 May 2006 15:55:32 -0600
Cc: kphotoalbum at kdab.net
On Tuesday 09 May 2006 14:48, Robert L Krawitz wrote:
> Hmm. I'm quite sure that I extracted it with Dave Coffin's parse
> program, and it was 1.5 MB, but I've set my camera to large fine +
> RAW. I thought the 20D and XT did the same thing. The original Rebel
> was certainly different.
Two images that I shot just now, same scene (mounted on a tripod).
The first was RAW+JPEG, the second RAW only:
-rw-r--r-- 1 shawn shawn 9485856 May 9 15:21 IMG_0547.CR2
-rw-r--r-- 1 shawn shawn 2645694 May 9 15:21 IMG_0547.JPG
-rw-r--r-- 1 shawn shawn 7230346 May 9 15:21 IMG_0548.CR2
Notice how much larger the first CR2 file is? I noticed that and
wondered why. Looking into it, I found that the CR2 from the
RAW+JPEG contains two embedded JPEGs. The relevant bits of the
exiftool output are:
Preview Image Length : 2627102
Thumbnail Length : 8864
And:
PreviewImageLength : 337791
ThumbnailLength : 9193
Extracting the preview images and running identify on them shows:
IMG_0547.jpg JPEG 3456x2304 DirectClass 2.5mb 0.810u 0:02
IMG_0548.jpg[1] JPEG 1536x1024 DirectClass 330kb
The downloaded JPEG is a bit larger than the extracted JPEG, but
using exiftool to copy the EXIF data from the CR2 to the extracted
JPEG gets them very close (the extracted JPEG + copied EXIF data is
a little larger). Finally, if I convert both JPEGs to PPM format,
they have identical md5sums.
Is the 20D really different in this respect?
It appears to be:
$ exiftool -b -ThumbnailImage img_0101.cr2 > img_0101.thm
$ exiftool -b -PreviewImage img_0101.cr2 > img_0101_pre.jpg
$ ls -l img_0101*
-r-------- 1 rlk users 8658421 2006-05-09 18:07 img_0101.cr2
-rw-r--r-- 1 rlk users 4434311 2006-05-09 18:10 img_0101.jpg
-rw-r--r-- 1 rlk users 9330 2006-05-09 18:09 img_0101.thm
-rw-r--r-- 1 rlk users 549774 2006-05-09 18:10 img_0101_pre.jpg
>From exiftool:
exiftool -v img_0101.cr2
ExifToolVersion = 6.16
FileName = img_0101.cr2
FileSize = 8658421
FileModifyDate = 1147212459
FileType = CR2
MIMEType = image/x-raw
+ [IFD0 directory with 14 entries]
| 0) ImageWidth = 1536
| 1) ImageHeight = 1024
| 2) BitsPerSample = 8 8 8
| 3) Compression = 6
| 4) Make = Canon
| 5) Model = Canon EOS 20D
| 6) PreviewImageStart = 9728
| 7) Orientation = 1
| 8) PreviewImageLength = 549774
| 9) XResolution = 72
| 10) YResolution = 72
| 11) ResolutionUnit = 2
| 12) ModifyDate = 2006:04:15 19:06:52
| 13) ExifOffset (SubDirectory) -->
...
+ [IFD1 directory with 2 entries]
| 0) ThumbnailOffset = 560014
| 1) ThumbnailLength = 9330
+ [IFD2 directory with 11 entries]
| 0) ImageWidth = 384
| 1) ImageHeight = 256
| 2) BitsPerSample = 8 8 8
| 3) Compression = 6
| 4) PhotometricInterpretation = 2
| 5) StripOffsets = 569856
| 6) SamplesPerPixel = 3
| 7) RowsPerStrip = 256
| 8) StripByteCounts = 294912
| 9) PlanarConfiguration = 1
| 10) Exif_0xc5d9 = 2
So maybe there is a difference between the 20D and the XT? Very
strange.
BTW, if you're not familiar with exiftool, look into it. It's kind
of slow, but the best EXIF manipulation tool I've found. It can
read EXIF data directly from the CR2 file, and it can copy EXIF
data, either wholesale or as specified from one file to another.
On Debian:
apt-get install libimage-exiftool-perl
> I never, NEVER edit the RAW file in any way. My import script
> sets it read-only as soon as it can.
I can see that. I've verified pretty thoroughly (to my
satisfaction, anyway) that removing the embedded JPEG from the RAW
file doesn't remove anything of substance, so I'm comfortable with
it. If I were to leave it in, I'd probably delete the downloaded
JPEG, since it's trivial to extract it from the CR2.
I guess I'm just paranoid -- my take is that you never muck with your
negatives, no matter what (I got into a little scuffle with the GIMP
folks who were shocked that I don't immediately rotate all of my files
to be in the correct orientation). And that means no matter what; any
exception is a slippery slope. What if your computer crashes while
it's mucking with the file?
More information about the Kphotoalbum
mailing list