Removing PreviewImage from CR2

Started by Archive, May 12, 2010, 08:54:05 AM

Previous topic - Next topic

Archive

[Originally posted by bogdan on 2007-06-07 16:53:52-07]

Hi Phil,

I wish to remove PreviewImage (embedded jpg) from CR2 file. If I use following:

exiftool -PreviewImage= xxx.CR2

-then (I suppose) PreviewImage is removed (CR2 file gets shorter too), but PreviewImageStart and PreviewImageLength tags remain in metadata (where PreviewImageLength has 0 value).

How to get rid of those two tags? Or are they needed to stay?

I've tried:

exiftool -PreviewImage&lt= xxx.CR2

-where both tags dissapear, but filesize of CR2 doesn't decrease -so I suppose embedded jpg remains in CR2 file in this case. Can you clarify a bit? Thanks.

Btw. what is the use of JFIF? I mean... some jpg's have it, another doesn't. Is it ok to remove complete JFIF and define resolution in exif area instead?

Greetings,

Bogdan

Archive

[Originally posted by exiftool on 2007-06-07 19:29:45-07]

What you have done will remove the preview image.  The tags
remain, but the PreviewImageLength will now be zero.  It isn't
a good idea to delete these tags since it is likely that some
software relies on their existence.  (Also, some may rely on
the previewImage itself, but that's another kettle of fish.)

I'm going to have to sit down and think about it for a while
to figure out why '-previewimage<=' deletes these tags, but
you are right: In this case, the preview image isn't deleted.
This is because the PreviewImage happens to fall at the end
of the file, and without PreviewImageStart pointing to it,
exiftool then treats it like an unknown trailer.  You can delete
unknown trailers like this with '-trailer:all='.

Technically, the JFIF information shouldn't exist in an EXIF
JPEG image.  It is redundant and not part of the EXIF spec.
But for some reason, certain utilities seem to add it anyway.
I have no idea why.

- Phil

Archive

[Originally posted by bogdan on 2007-06-07 20:09:16-07]

Did I ever thank you for fast replays? I do now :-)

About removing preview... I think you're right about keeping tags there -I was just wondering if that is "expected" ExifTool behaviour.

Till your answer, I didn't notice "trailer" term anywhere... a lot stuff to learn :-)

And new questions raise all the time.. I hope you don't mind another (unrelated) question here:

Canon MakerNotes section has LensType tag, which you describe there (on your web page) as string, but later down, you specified which number describe particular lens. So, to set LensType tag, "-n" must be used... doesn't matter really. Here's the question:

How did you get those numbers (which describe lens being used)? I mean, my camera (350D) doesn't write into LensType tag... it is always -1 =unknown (even if I use one of the lenses from your specs). I've changed LensType tag according to my lens and when reading, ExifTool shows correct lens (of course). Do other Canon cameras write into LensType?

Ok.. then I'll give you a break :-)

Best wishes,

Bogdan

Archive

[Originally posted by exiftool on 2007-06-07 22:13:20-07]

Hi Bogdan,

I don't mind answering questions like these where the
answers can't be found in the documentation.

If you look you should find two Canon LensType tags.
Older cameras used a numerical tag which required
translating, but newer cameras use a string version
of this tag instead.  And some of the newer cameras
still have the numerical version but always write -1.
From my sample images, here is the breakdown:

Using the integer only: D30, 1D, 1Ds, 1DmkII and 1DSmkII

Using the string only: 5D and 1DmkIII

Using both properly: 400D

Using both with integer set to -1: D60 and 30D

Integer only, but set to -1: 10D, 300D, 350D and 1DmkIIN

- Phil