ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: et2511299562 on July 09, 2013, 06:23:23 AM

Title: Re: Removing serial number tags from Canon CR2 (RAW file)
Post by: et2511299562 on July 09, 2013, 06:23:23 AM
Continuing this archived thread:

https://exiftool.org/forum/index.php/topic,2660.msg11730.html

Quote
[Originally posted by pauljsolomon on 2010-03-20 23:14:00.222128-07]

I'm trying to remove the camera serial number from my Canon CR2 (RAW) files with exiftool.

I am using:    exiftool -serialNumber= 

and it doesn't work.  What is the right way to do this?

thanks.

-paul.

Quote
[Originally posted by exiftool on 2010-03-21 10:56:15.756137-07]

Hi Paul,

Unfortunately makernote tags may not be deleted (to avoid
confusing the Canon software among other reasons).  Instead,
set the serial number to something else.  ie)

exiftool -canon:serialnumber=0 FILE

- Phil
Canon makes cameras which shoot raw and do not embed a serial number, for example the PowerShot S100.

I have processed pictures in DPP, Lightroom, etc., and the absence of a serial number doesn't seem to be a problem in any way whatsoever.

Furthermore, from my understanding, Canon's implementation of the serial number value is inconsistent; sometimes it's a string, other times it's an integer.

I would like to be able to completely strip the serial number out of my raw files, out of the maker notes. Setting the serial number to something invalid as you suggested is technically a workaround.

Is this something that you would consider implementing? I don't believe that stripping the serial number out will break any spec.

Thanks
Title: Re: Removing serial number tags from Canon CR2 (RAW file)
Post by: Phil Harvey on July 09, 2013, 07:20:11 AM
If I add the ability to strip out this one tag, then I need to add the ability to add it back again.  As you point out, the Canon serial number is inconsistent.  It would be wrong to allow the serial number to be added with cameras that don't write it in the first place, but preventing this would require extra logic that is specific to each model, which is a maintenance nightmare for me.

But luckily, ExifTool provides a way for you to do whatever you want, regardless of whether I want to add this ability to the production ExifTool or not. The following config file will give you the ability to delete the Canon SerialNumber:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Canon::Main' => {
        0x0c => {
            Name => 'SerialNumber',
            Writable => 'int32u',
            Permanent => 0, # allow this tag to be deleted
        },
    },
);
1;  #end


See the config file documentation (https://exiftool.org/config.html) for more information about the ExifTool config file.

- Phil
Title: Re: Removing serial number tags from Canon CR2 (RAW file)
Post by: et2511299562 on July 18, 2013, 12:18:05 AM
I was able to use your ExifTool_config example to remove the SerialNumber tag, but I tried to extend it to remove other tags like InternalSerialNumber and LensSerialNumber, but couldn't get things to work.

Could you briefly explain where the "0x0c" is derived from? Is it the FIRST_ENTRY index?

Is there a way to genericize this ExifTool_config file to work with all brands of cameras, not just Canon?

Thanks again!
Title: Re: Removing serial number tags from Canon CR2 (RAW file)
Post by: Phil Harvey on July 18, 2013, 07:31:17 AM
0x0c is the Tag ID.  See the Canon Tags documentation (https://exiftool.org/TagNames/Canon.html) for a complete list.

- Phil
Title: Re: Removing serial number tags from Canon CR2 (RAW file)
Post by: et2511299562 on August 04, 2013, 01:48:23 AM
Thanks, I got things working.

I'm getting the following warnings for every Canon file, however, even though I'm not doing anything with Leica or Pentax namespaces:

Warning: Can't delete Leica:SerialNumber
Warning: Can't delete Pentax:InternalSerialNumber
Title: Re: Removing serial number tags from Canon CR2 (RAW file)
Post by: Phil Harvey on August 04, 2013, 07:45:37 AM
When you write a tag without specifying a location, ExifTool attempts to set the value of all possible tags of that name.

- Phil