News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Adding a custom tag shows up as null when all tags are queried

Started by kpg, November 16, 2016, 05:57:36 PM

Previous topic - Next topic

kpg

Hello,

I added a new tag (AssetID) to a .jpg file using the following config,

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::xmp' => {
        AssetID => { Writable => 'string', Groups => { 1 => 'XMP' } },
    },
);

Now, when I try to get all tags, the added tag shows up as nil, as follows,

"ExifByteOrder",
"Orientation",
"ModifyDate",
"ImageUniqueID",
"XMPToolkit",
nil,
"ImageWidth",
"ImageHeight",
"EncodingProcess",


But, when I try to get file.AssetID, it gives the value I had given for AssetID. Can you please tell me what I am doing wrong.

Thanks,
kpg



Phil Harvey

I get this with ExifTool 10.33 using your config file:

> exiftool a.jpg -assetid=test
    1 image files updated
> exiftool a.jpg -G1 -a -assetid
[XMP-getty]     Asset ID                        : test
[XMP-xmp]       Asset ID                        : test


So it worked, but apparently AssetID was already defined in the XMP-getty group.

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

kpg

I can retrieve AssetID but when I try to get all tag, I still get nil,

Code to get all tags:

      creative_xmp = MiniExiftool.new creative_file
      assetID = creative_xmp.to_hash
   
The result is as follows (The ID that I have added is ''c647a2ee3883241a6d1841b3addf6fb3''):

{"ExifToolVersion"=>9.27,
"FileSize"=>"12 kB",
"FileModifyDate"=>2016-11-16 21:47:30 -0800,
"FileAccessDate"=>2016-11-16 21:52:56 -0800,
"FileInodeChangeDate"=>2016-11-16 21:47:30 -0800,
"FilePermissions"=>"rw-r--r--",
"FileType"=>"JPEG",
"MIMEType"=>"image/jpeg",
"JFIFVersion"=>1.02,
"ResolutionUnit"=>"None",
"XResolution"=>1,
"YResolution"=>1,
"OcadRevision"=>20193,
"ExifByteOrder"=>"Big-endian (Motorola, MM)",
"Orientation"=>"Horizontal (normal)",
"ModifyDate"=>2012-08-22 11:12:24 -0700,
"ImageUniqueID"=>"BF3BEA942CA7482A8A1B0EE8E8679E12",
"XMPToolkit"=>"Image::ExifTool 9.27",
nil=>"c647a2ee3883241a6d1841b3addf6fb3",
"ImageWidth"=>445,
"ImageHeight"=>269,
"EncodingProcess"=>"Baseline DCT, Huffman coding",
"BitsPerSample"=>8,
"ColorComponents"=>3,
"YCbCrSubSampling"=>"YCbCr4:2:0 (2 2)",
"ImageSize"=>"445x269"}


Phil Harvey

Can you reproduce this from the command line version of ExifTool?  I don't know how MiniExifTool works, and I don't see the problem when I run from the command line.

But first I might suggest updating to a more recent version of ExifTool to see if the problem goes away.  The current version is 10.33, and the version you are running is more than 3 years old.

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

kpg

Thank you so much :) I used ExifTool instead of MiniExifTool and I am able to see all the user defined tags :)

One more question:

Why is another file called _original getting created when I add a new tag? Is there a way to avoid it?

Phil Harvey

Quote from: kpg on November 17, 2016, 01:36:21 PM
Why is another file called _original getting created when I add a new tag? Is there a way to avoid it?

ExifTool automatically saves a your original file to act as a backup.  Add -overwrite_original to the command to avoid this.

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

kpg

thank you so much for helping me with this. really appreciate your time and patience! you are awesome :)