Creating new user defined tags

Started by hassan, November 27, 2019, 11:04:59 AM

Previous topic - Next topic

hassan

Hi
I am trying to create 4 new user defined tags to add specific info into my photos, this is my elr.config file

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Exif::Main' => {
        # 1.  EXIF:Elr
        0xd000 => {
            Name => 'Elr',
            Writable => 'string',
WriteGroup => 'IFD0',

        },
        # 2.  EXIF:Miles
   0xd001 => {
            Name => 'Miles',
            Writable => 'int16u',
WriteGroup => 'IFD0',
        },
# 3.  EXIF:Yards
   0xd002 => {
            Name => 'Yards',
            Writable => 'rational64s',
WriteGroup => 'IFD0',
        },
# 4.  EXIF:Chains
   0xd004 => {
            Name => 'Chains',
            Writable => 'rational64s',
WriteGroup => 'IFD0',
        },
},
);

and when run this (on windows)
$ ./exiftool/exiftool -config elr.config -EXIF:Elr='GSW'  -EXIF:Miles='10' -EXIF:Yards='15' -EXIF:Chains='20' ./b.jpg

output:
Warning: [minor] Entries in ExifIFD were out of sequence. Fixed. - ./b.jpg
    1 image files updated


I then tried to find out if these tags were created and saved the changes, so I used

$ ./exiftool/exiftool -H -G1 ./b.jpg

and the output does not have these new tags (see below). I am not sure what is wrong with this? :(

[ExifTool]           - ExifTool Version Number         : 11.65
[System]             - File Name                       : b.jpg
[System]             - Directory                       : .
[System]             - File Size                       : 1040 kB
[System]             - File Modification Date/Time     : 2019:11:27 15:54:29+00:00
[System]             - File Access Date/Time           : 2019:11:27 15:54:29+00:00
[System]             - File Inode Change Date/Time     : 2019:11:27 15:55:31+00:00
[System]             - File Permissions                : rw-r--r--
[File]               - File Type                       : JPEG
[File]               - File Type Extension             : jpg
[File]               - MIME Type                       : image/jpeg
[File]               - Exif Byte Order                 : Little-endian (Intel, II)
[File]               - Image Width                     : 11000
[File]               - Image Height                    : 5500
[File]               - Encoding Process                : Baseline DCT, Huffman coding
[File]               - Bits Per Sample                 : 8
[File]               - Color Components                : 3
[File]               - Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
[IFD0]          0x010e Image Description               : S/N:01617
[IFD0]          0x010f Make                            : NCTECH LTD
[IFD0]          0x0110 Camera Model Name               : iSTAR Pulsar
[IFD0]          0x0112 Orientation                     : Horizontal (normal)
[IFD0]          0x011a X Resolution                    : 300
[IFD0]          0x011b Y Resolution                    : 300
[IFD0]          0x0128 Resolution Unit                 : inches
[IFD0]          0x0131 Software                        : VR.World
[IFD0]          0x0132 Modify Date                     : 2019:11:21 18:01:42
[IFD0]          0x0213 Y Cb Cr Positioning             : Co-sited
[ExifIFD]       0x829a Exposure Time                   : 0
[ExifIFD]       0x829d F Number                        : 2.0
[ExifIFD]       0x8822 Exposure Program                : Aperture-priority AE
[ExifIFD]       0x8827 ISO                             : 0
[ExifIFD]       0x9000 Exif Version                    : 0220
[ExifIFD]       0x9003 Date/Time Original              : 2019:11:21 18:01:42
[ExifIFD]       0x9004 Create Date                     : 2019:11:21 18:01:42
[ExifIFD]       0x9207 Metering Mode                   : Average
[ExifIFD]       0x9208 Light Source                    : Unknown
[ExifIFD]       0x9209 Flash                           : No flash function
[ExifIFD]       0x920a Focal Length                    : 2.6 mm
[ExifIFD]       0xa001 Color Space                     : sRGB
[ExifIFD]       0xa300 File Source                     : Digital Camera
[ExifIFD]       0xa301 Scene Type                      : Directly photographed
[ExifIFD]       0xa402 Exposure Mode                   : Manual
[ExifIFD]       0xa403 White Balance                   : Auto
[ExifIFD]       0xa404 Digital Zoom Ratio              : 1
[ExifIFD]       0xa408 Contrast                        : Normal
[ExifIFD]       0xa409 Saturation                      : Normal
[ExifIFD]       0xa40a Sharpness                       : Normal
[GPS]           0x0000 GPS Version ID                  : 2.2.0.0
[GPS]           0x0001 GPS Latitude Ref                : North
[GPS]           0x0003 GPS Longitude Ref               : West
[GPS]           0x0005 GPS Altitude Ref                : Above Sea Level
[GPS]           0x0008 GPS Satellites                  : 20
[GPS]           0x0010 GPS Img Direction Ref           : Magnetic North
[GPS]           0x0011 GPS Img Direction               : 240.18
[XMP-x]              - XMP Toolkit                     : NCTech XMP tool
[XMP-GPano]          - Use Panorama Viewer             : True
[XMP-GPano]          - Projection Type                 : equirectangular
[XMP-GPano]          - Pose Heading Degrees            : 240.184
[XMP-GPano]          - Pose Pitch Degrees              : -0
[XMP-GPano]          - Pose Roll Degrees               : 0
[XMP-GPano]          - Cropped Area Image Width Pixels : 11000
[XMP-GPano]          - Cropped Area Image Height Pixels: 5500
[XMP-GPano]          - Full Pano Width Pixels          : 11000
[XMP-GPano]          - Full Pano Height Pixels         : 5500
[XMP-GPano]          - Cropped Area Left Pixels        : 0
[XMP-GPano]          - Cropped Area Top Pixels         : 0
[Composite]          - Aperture                        : 2.0
[Composite]          - Image Size                      : 11000x5500
[Composite]          - Megapixels                      : 60.5
[Composite]          - Shutter Speed                   : 0
[Composite]          - GPS Altitude                    : 278.5 m Above Sea Level
[Composite]          - GPS Latitude                    : 55 deg 37' 13.59" N
[Composite]          - GPS Longitude                   : 4 deg 10' 45.88" W
[Composite]          - Focal Length                    : 2.6 mm
[Composite]          - GPS Position                    : 55 deg 37' 13.59" N, 4 deg 10' 45.88" W




Phil Harvey

You will only see a custom EXIF when reading if you either use the same config file or the -u option.

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

hassan

Great, many thanks for this quick response. I really appreciate that
I now used
$ ./exiftool/exiftool -H -G1 -u ./b.jpg
and the output has

[IFD0]          0xd000 Exif 0xd000                     : GSW
[IFD0]          0xd001 Exif 0xd001                     : 10
[IFD0]          0xd002 Exif 0xd002                     : 15
[IFD0]          0xd004 Exif 0xd004                     : 20

how could I change the text (in red) to match their names in my code?
I tried to read them indivdually using
$ ./exiftool/exiftool -Exif 0xd000 ./b.jpg
output
Error: File not found - 0xd000
======== ./b.jpg
EXIF                            : (Binary data 836 bytes, use -b option to extract)
    1 image files read
    1 files could not be read

Cheers


Phil Harvey

Quote from: hassan on November 27, 2019, 11:24:15 AM
how could I change the text (in red) to match their names in my code?

To see the custom tag names you must use your config file.  Tag names aren't stored in EXIF metadata.  Perhaps you should use XMP if you want to see the tag names without using a custom config file.  EXIF tags are not designed to be extensible.

QuoteI tried to read them indivdually using
$ ./exiftool/exiftool -Exif 0xd000 ./b.jpg

Use the -s option when extracting to see the tag names:

./exiftool/exiftool -H -G1 -u -s ./b.jpg

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

hassan

Great, I used XMP and it works fine

many thanks
Hassan

hassan

Hi again
I have another question: would it be possible to show these user defined tags in the image properties (i.e. when rightclick to show image properties -> details -> to see these new tags within the list)?

Thanks
Hassan

StarGeek

No, because the OS doesn't have code to understand your user defined tags.

Very few programs beyond exiftool will able to read any user defined tags, much less edit them.  IMO, it's always better to try and fit the data into already defined tags if possible.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

hassan

Thanks StarGeek for your helpful reply;

I looked into already defined tags and chose Copyright tag to fit my data (as its a composite data of text and numbers) as follows
./exiftool/exiftool -copyright="GSW 14.500 45.5" ./a.jpg
which works fine but when check the image properties, it is still possible to change the data there (i.e. still rw), would it possible to change the writing permission for copyright tag to be read only after setting the data instead of being read/right through image properties? I believe this should be possible specially for copyright tag.
also, would it be possible to change the tag description so when check the tag through image properties the description define the added data?
Regards;

Phil Harvey

You can't set any metadata to be read-only.  There are no permissions associated with the metadata tags.

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

hassan

Thanks Phil
how about changing the description, is this possible?

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

hassan

Great, I searched on how to change the description of a tag (such as Copyright tag) but couldnt find anything related. Is there a commandline to do that?

Thanks
Hassan

Phil Harvey

You would a line like this to the custom tag definition:

    Description => 'Some description',

But maybe I'm not understanding what you are asking.

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

StarGeek

If you mean change the name of the tag, like change Copyright to say, MyElr, then yes it is possible, but it won't change how other programs read it.  Lightroom, for example, will still read it as Copyright
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).