Re: Removing serial number tags from Canon CR2 (RAW file)

Started by et2511299562, July 09, 2013, 06:23:23 AM

Previous topic - Next topic

et2511299562

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

Phil Harvey

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 for more information about the ExifTool config file.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

et2511299562

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!

Phil Harvey

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

et2511299562

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

Phil Harvey

When you write a tag without specifying a location, ExifTool attempts to set the value of all possible tags of that name.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).