Main Menu

Make tag ascii count

Started by johu, January 02, 2014, 05:31:51 AM

Previous topic - Next topic

johu

Hi I am trying to use exiftool to batch set make tag to certain value. I was able to manually do this with leadtools tiff tag editor, but while doing this with exiftool the result is different. I am trying to create a tag with four letters and in tiff tag editor it creates a tag with ascii count 4. If I use exiftool to do this the ascii count is 5. Also using tagfromfile does the same even if the tag is copied from a file that has ascii count 4. This is a problem since they need to be exactly identical in order to behave the same way if files are put in order based on tags.

Phil Harvey

The EXIF specification states that ASCII values should be null-terminated.  So if I understand what you are telling me, it seems as if the leadtools tiff tag editor writes the ASCII value incorrectly, because a 4-character ASCII value should be stored with a count of 5 to include the terminator.

- 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 ($).

johu

Hi Phil,
the problem is that I have Tiff files with a specific make tag and I need to edit existing Tiff files from another source to have the same make tag with same count in order for them to work the same way. I found also another software that creates tag with the same count as the amount of letters, but again that requires manual editing and I would so much like to do this as a batch process. But judging by what you are telling me this can not be achieved with Exiftool.

Phil Harvey

I didn't say you couldn't do it.  I just said it was wrong.

To do this with ExifTool would require overriding the desired tag with a UserDefined tag.  The following config file will do this for EXIF:Make.

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Exif::Main' => {
        0x10f => {
            Name => 'Make',
            Groups => { 2 => 'Camera' },
            DataMember => 'Make',
            # remove trailing blanks and save as an ExifTool member variable
            RawConv => '$val =~ s/\s+$//; $$self{Make} = $val',
            Writable => 'string',
            WriteGroup => 'IFD0',
            # override Format to write without a null terminator (NOTE: non-standard EXIF)
            Format => 'undef',
        },
    },
);
1; # end


- 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 ($).

johu

Hi Phil,
thanks. That was not just fast but spot on for my needs!!!