ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: Newsky on September 04, 2015, 01:55:28 AM

Title: disappearance Country-Primary Location Code
Post by: Newsky on September 04, 2015, 01:55:28 AM
I use Lightroom 6.1.1
Plugin Jeffrey Friedl "jf Flickr"
Plugin Jeffrey Friedl "jf Run Any Command"
The data source file:
---- ExifTool ----
ExifTool Version Number         : 10.01
---- File ----
File Name                       : 2014-12-29 18-17-16.jpg
Directory                       : .
File Size                       : 5.6 MB
File Modification Date/Time     : 2015:08:29 05:23:29+03:00
File Access Date/Time           : 2015:09:04 07:49:15+03:00
File Creation Date/Time         : 2015:08:22 07:43:32+03:00
File Permissions                : rw-rw-rw-
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
Exif Byte Order                 : Little-endian (Intel, II)
Current IPTC Digest             : 9d0937e97d943db82a9f4c81429cc797
Image Width                     : 5609
Image Height                    : 3739
Encoding Process                : Baseline DCT, Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
---- EXIF ----
Make                            : Canon
Camera Model Name               : Canon EOS 5D Mark II
Orientation                     : Horizontal (normal)
X Resolution                    : 240
Y Resolution                    : 240
Resolution Unit                 : inches
Software                        : Adobe Photoshop Lightroom 5.7 (Windows)
Modify Date                     : 2014:12:30 19:10:57
Artist                          : Aleksandr Newsky
Copyright                       : © Hot Laboratory Records
Exposure Time                   : 1/40
F Number                        : 4.0
Exposure Program                : Program AE
ISO                             : 2500
Exif Version                    : 0230
Date/Time Original              : 2014:12:29 18:17:16
Create Date                     : 2014:12:29 18:17:16
Shutter Speed Value             : 1/40
Aperture Value                  : 4.0
Exposure Compensation           : 0
Max Aperture Value              : 4.0
Metering Mode                   : Multi-segment
Flash                           : Off, Did not fire
Focal Length                    : 35.0 mm
Image Number                    : 0
Sub Sec Time Original           : 97
Focal Plane X Resolution        : 3849.211765
Focal Plane Y Resolution        : 3908.141975
Focal Plane Resolution Unit     : inches
Custom Rendered                 : Normal
Exposure Mode                   : Auto
White Balance                   : Auto
Scene Capture Type              : Standard
Saturation                      : Normal
Sharpness                       : Normal
Owner Name                      : Aleksandr Newsky
Serial Number                   : 1531013794
Lens Info                       : 24-105mm f/?
Lens Model                      : EF24-105mm f/4L IS USM
GPS Version ID                  : 2.2.0.0
GPS Latitude Ref                : North
GPS Latitude                    : 55.753285Ѝ
GPS Longitude Ref               : East
GPS Longitude                   : 37.621763Ѝ
GPS Altitude                    : 130.5 m
Compression                     : JPEG (old-style)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Thumbnail Offset                : 1098
Thumbnail Length                : 10285
---- XMP ----
XMP Toolkit                     : Adobe XMP Core 5.6-c011 79.156380, 2014/05/21-23:38:37
Country Code                    : RU
Location                        : Красная Площадь
Approximate Focus Distance      : 11.9
Firmware                        : 2.1.2
Flash Compensation              : 0
Image Number                    : 0
Lens                            : EF24-105mm f/4L IS USM
Lens ID                         : 237
Lens Info                       : 24-105mm f/?
Owner Name                      : Aleksandr Newsky
Serial Number                   : 1531013794
Create Date                     : 2014:12:29 18:17:16+03:00
Creator Tool                    : Adobe Photoshop Lightroom 5.7 (Windows)
Metadata Date                   : 2015:08:29 05:23:29+03:00
Modify Date                     : 2014:12:30 19:10:57
Rating                          : 4
Marked                          : True
Web Statement                   : http://videoprogulka.ru
Already Applied                 : True
Auto Lateral CA                 : 0
Auto White Version              : 134348800
Blacks 2012                     : 0
Blue Hue                        : 0
Blue Saturation                 : 0
Camera Profile                  : Embedded
Clarity 2012                    : 0
Color Noise Reduction           : 0
Contrast 2012                   : 0
Convert To Grayscale            : False
Defringe Green Amount           : 0
Defringe Green Hue Hi           : 60
Defringe Green Hue Lo           : 40
Defringe Purple Amount          : 0
Defringe Purple Hue Hi          : 70
Defringe Purple Hue Lo          : 30
Exposure 2012                   : 0.00
Grain Amount                    : 0
Green Hue                       : 0
Green Saturation                : 0
Has Crop                        : False
Has Settings                    : True
Highlights 2012                 : 0
Hue Adjustment Aqua             : 0
Hue Adjustment Blue             : 0
Hue Adjustment Green            : 0
Hue Adjustment Magenta          : 0
Hue Adjustment Orange           : 0
Hue Adjustment Purple           : 0
Hue Adjustment Red              : 0
Hue Adjustment Yellow           : 0
Incremental Temperature         : 0
Incremental Tint                : 0
Lens Manual Distortion Amount   : 0
Lens Profile Enable             : 0
Lens Profile Setup              : LensDefaults
Luminance Adjustment Aqua       : 0
Luminance Adjustment Blue       : 0
Luminance Adjustment Green      : 0
Luminance Adjustment Magenta    : 0
Luminance Adjustment Orange     : 0
Luminance Adjustment Purple     : 0
Luminance Adjustment Red        : 0
Luminance Adjustment Yellow     : 0
Luminance Smoothing             : 0
Parametric Darks                : 0
Parametric Highlight Split      : 75
Parametric Highlights           : 0
Parametric Lights               : 0
Parametric Midtone Split        : 50
Parametric Shadow Split         : 25
Parametric Shadows              : 0
Perspective Aspect              : 0
Perspective Horizontal          : 0
Perspective Rotate              : 0.0
Perspective Scale               : 100
Perspective Upright             : 0
Perspective Vertical            : 0
Post Crop Vignette Amount       : 0
Process Version                 : 6.7
Raw File Name                   : 2014-12-29 18-17-16.jpg
Red Hue                         : 0
Red Saturation                  : 0
Saturation                      : 0
Saturation Adjustment Aqua      : 0
Saturation Adjustment Blue      : 0
Saturation Adjustment Green     : 0
Saturation Adjustment Magenta   : 0
Saturation Adjustment Orange    : 0
Saturation Adjustment Purple    : 0
Saturation Adjustment Red       : 0
Saturation Adjustment Yellow    : 0
Shadow Tint                     : 0
Shadows 2012                    : 0
Sharpen Detail                  : 25
Sharpen Edge Masking            : 0
Sharpen Radius                  : +1.0
Sharpness                       : 0
Split Toning Balance            : 0
Split Toning Highlight Hue      : 0
Split Toning Highlight Saturation: 0
Split Toning Shadow Hue         : 0
Split Toning Shadow Saturation  : 0
Tone Curve Name                 : Linear
Tone Curve Name 2012            : Linear
Version                         : 8.7
Vibrance                        : 0
Vignette Amount                 : 0
White Balance                   : Auto
Whites 2012                     : 0
Date Created                    : 2014:12:29 18:17:16+03:00
City                            : Москва
State                           : г. Москва
Country                         : Россия
Format                          : image/jpeg
Document ID                     : 2C094FEFEC645A0D67C0AFC98BF08D64
Original Document ID            : 2C094FEFEC645A0D67C0AFC98BF08D64
Instance ID                     : xmp.iid:f3482364-4168-2640-80f5-d1b6de36ab22
Creator City                    : Moscow
Creator Country                 : Russia
Creator Work Email              : newsky013@***
Creator Work Telephone          : +7925*****
Creator Work URL                : http://videoprogulka.ru
Tone Curve                      : 0, 0*255, 255
Tone Curve Blue                 : 0, 0*255, 255
Tone Curve Green                : 0, 0*255, 255
Tone Curve PV2012               : 0, 0*255, 255
Tone Curve PV2012 Blue          : 0, 0*255, 255
Tone Curve PV2012 Green         : 0, 0*255, 255
Tone Curve PV2012 Red           : 0, 0*255, 255
Tone Curve Red                  : 0, 0*255, 255
Creator                         : Aleksandr Newsky
Rights                          : © Hot Laboratory Records
Subject                         : 2014*Architecture*Buildings*Evening Shot*Evening city*Lamppost*Moscow*Old Town*Outdoors*People*Red Square*Russia*Saint Basil's Cathedral*Trees*Архитектура*Брусчатка*Вечерний Город*Вечерний Снимок*Высотка*Деревья*Зима*Котельническая набережная*Красная Площадь*Купола*Люди*Москва*На Улице*Памятник Архитектуры*Памятник Минину И Пожарскому*Покровский Собор*Прогулка*Процесс*Россия*Собор Покрова Пресвятой Богородиц*Социум*Старый Город*Строения*Флора*Фонарный Столб*Храм Василия Блаженного
History Action                  : saved
History Instance ID             : xmp.iid:f3482364-4168-2640-80f5-d1b6de36ab22
History When                    : 2015:08:29 05:23:29+03:00
History Software Agent          : Adobe Photoshop Lightroom 6.1.1 (Windows)
History Changed                 : /metadata
Hierarchical Subject            : 2014*Architecture*Buildings*Evening Shot*Evening city*Lamppost*Moscow*Old Town*Outdoors*People*Red Square*Russia*Saint Basil's Cathedral*Trees*Архитектура*Архитектура|Памятник Архитектуры*Архитектура|Строения*Брусчатка*Вечерний Город*Вечерний Снимок*Зима*Купола*Люди*Люди|Социум*На Улице*Покровский Собор*Процесс*Процесс|Прогулка*Россия*Россия|Москва*Россия|Москва|Котельническая набережная*Россия|Москва|Котельническая набережная|Высотка*Россия|Москва|Красная Площадь*Россия|Москва|Красная Площадь|Памятник Минину И Пожарскому*Россия|Москва|Храм Василия Блаженного*Собор Покрова Пресвятой Богородиц*Старый Город*Флора*Флора|Деревья*Фонарный Столб
---- Photoshop ----
X Resolution                    : 240
Displayed Units X               : inches
Y Resolution                    : 240
Displayed Units Y               : inches
Copyright Flag                  : True
URL                             : http://videoprogulka.ru
Photoshop Thumbnail             : (Binary data 10285 bytes, use -b option to extract)
IPTC Digest                     : 9d0937e97d943db82a9f4c81429cc797
---- IPTC ----
Coded Character Set             : UTF8
Envelope Record Version         : 4
Application Record Version      : 4
Keywords                        : 2014*Architecture*Buildings*Evening Shot*Evening city*Lamppost*Moscow*Old Town*Outdoors*People*Red Square*Russia*Saint Basil's Cathedral*Trees*Архитектура*Брусчатка*Вечерний Город*Вечерний Снимок*Высотка*Деревья*Зима*Котельническая набережная*Красная Площадь*Купола*Люди*Москва*На Улице*Памятник Архитектуры*Памятник Минину И Пожарскому*Покровский Собор*Прогулка*Процесс*Россия*Собор Покрова Пресвятой Богородиц*Социум*Старый Город*Строения*Флора*Фонарный Столб*Храм Василия Блаженного
Date Created                    : 2014:12:29
Time Created                    : 18:17:16+03:00
Digital Creation Date           : 2014:12:29
Digital Creation Time           : 18:17:16+03:00
By-line                         : Aleksandr Newsky
City                            : Москва
Sub-location                    : Красная Площадь
Province-State                  : г. Москва
Country-Primary Location Code   : RU
Country-Primary Location Name   : Россия
Copyright Notice                : © Hot Laboratory Records
---- ICC_Profile ----
Profile CMM Type                : Lino
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 1998:02:09 06:49:00
Profile File Signature          : acsp
Primary Platform                : Microsoft Corporation
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : IEC
Device Model                    : sRGB
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : HP
Profile ID                      : 0
Profile Copyright               : Copyright (c) 1998 Hewlett-Packard Company
Profile Description             : sRGB IEC61966-2.1
Media White Point               : 0.95045 1 1.08905
Media Black Point               : 0 0 0
Red Matrix Column               : 0.43607 0.22249 0.01392
Green Matrix Column             : 0.38515 0.71687 0.09708
Blue Matrix Column              : 0.14307 0.06061 0.7141
Device Mfg Desc                 : IEC http://www.iec.ch
Device Model Desc               : IEC 61966-2.1 Default RGB colour space - sRGB
Viewing Cond Desc               : Reference Viewing Condition in IEC61966-2.1
Viewing Cond Illuminant         : 19.6445 20.3718 16.8089
Viewing Cond Surround           : 3.92889 4.07439 3.36179
Viewing Cond Illuminant Type    : D50
Luminance                       : 76.03647 80 87.12462
Measurement Observer            : CIE 1931
Measurement Backing             : 0 0 0
Measurement Geometry            : Unknown
Measurement Flare               : 0.999%
Measurement Illuminant          : D65
Technology                      : Cathode Ray Tube Display
Red Tone Reproduction Curve     : (Binary data 2060 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 2060 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 2060 bytes, use -b option to extract)
---- APP14 ----
DCT Encode Version              : 100
APP14 Flags 0                   : [14], Encoded with Blend=1 downsampling
APP14 Flags 1                   : (none)
Color Transform                 : YCbCr
---- Composite ----
Aperture                        : 4.0
Date/Time Created               : 2014:12:29 18:17:16+03:00
Digital Creation Date/Time      : 2014:12:29 18:17:16+03:00
GPS Latitude                    : 55.753285РN
GPS Longitude                   : 37.621763РE
GPS Position                    : 55.753285РN, 37.621763РE
Image Size                      : 5609x3739
Megapixels                      : 21.0
Scale Factor To 35 mm Equivalent: 1.0
Shutter Speed                   : 1/40
Date/Time Original              : 2014:12:29 18:17:16.97
Thumbnail Image                 : (Binary data 10285 bytes, use -b option to extract)
Circle Of Confusion             : 0.031 mm
Field Of View                   : 55.5 deg
Focal Length                    : 35.0 mm (35 mm equivalent: 34.2 mm)
Hyperfocal Distance             : 9.96 m
Lens ID                         : Canon EF 24-105mm f/4L IS
Light Value                     : 4.7


My code for export to Flickr is as follows:

c:\ExifToolGUI\exiftool.exe -config c:\ExifToolGUI\ExifTool_config_convert_regions "-regioninfomp<MyRegionMP" -xmp-acdsee:all= -xmp-xmpmm:all= -xmp-photoshop:all= "-iptc:country-primarylocationname>xmp:LocationShownCountryName" "-iptc:province-state>xmp:LocationShownProvinceState" "-iptc:city>xmp:LocationShownCity" "-xmp:Location>iptc:Sub-location" "-xmp:Location>xmp:LocationShownSublocation" -charset Cyrillic -xmp-dc:description="{People=*\%N (%s);prefix "На фото: ";oldest first} Место съёмки {Country}, {Province}, {City}, {Location}. {DD} {Month} {YYYY}" -charset Cyrillic -xpcomment="{People=*\%N (%s);prefix "На фото: ";oldest first} Место съёмки {Country}, {Province}, {City}, {Location}. {DD} {Month} {YYYY}" -overwrite_original -m "{FILE}"

All commands are processed as it should, but disappears in the value of Country-Primary Location Code

Here is the file, which eventually loaded into Flickr: (See attachment 2014-12-29 18-17-16_after_export.txt )

When you try to
-xmp-iptccore:CountryCode>iptc:Country-PrimaryLocationCode

I get the error:

Quote======== ./2014-12-29 18-17-16_after_export.jpg
Nothing changed in ./2014-12-29 18-17-16_after_export.jpg
    0 image files updated
    1 image files unchanged
Warning: String too short (minlen is 3) for IPTC:Country-PrimaryLocationCode - ./2014-12-29 18-17-16_after_export.jpg
Warning: No writable tags set from ./2014-12-29 18-17-16_after_export.jpg
<-END-

Why is the value of the IPTC:Country-PrimaryLocationCode disappear?
Why is this field should be at least 3 characters?

archive with photos (https://dl.dropboxusercontent.com/u/13307457/Country-Primary%20Location%20Code.zip)
Title: Re: disappearance Country-Primary Location Code
Post by: Phil Harvey on September 04, 2015, 07:49:23 AM
The IPTC IIM specification (http://www.iptc.org/std/IIM/4.1/specification/IIMV4.1.pdf) requires a 3-character country code for Country-PrimaryLocationCode.

- Phil
Title: Re: disappearance Country-Primary Location Code
Post by: Newsky on September 07, 2015, 11:26:38 AM
I do not understand...
if this is the standard, why such LR default inserts a 2 character (but provides for input and 2 or 3 characters)

(http://img.maryno.net/images/ef13d3fb408cdb21b0934e53807caff2/547541bf9b6a8d5bfecc16b220067b10.png)

And Jeffrey's "Geoencoding Support" Plugin for Lightroom (http://regex.info/blog/lightroom-goodies/gps) so the same uses 2 symbols (ISO 3166 Alpha-2 code)

(http://img.maryno.net/images/ef13d3fb408cdb21b0934e53807caff2/c35acc7d83e69b8c3d5236cebdfc30d3.png)
Title: Re: disappearance Country-Primary Location Code
Post by: Phil Harvey on September 08, 2015, 07:39:40 AM
I think that Adobe uses XMP not IPTC IIM.

- Phil
Title: Re: disappearance Country-Primary Location Code
Post by: Newsky on September 08, 2015, 05:30:34 PM
And I have here that goes...
https://youtu.be/mofk0jIjPpw
Title: Re: disappearance Country-Primary Location Code
Post by: Hayo Baan on September 09, 2015, 02:15:01 AM
Well, it seems Adobe is simply violating the standard here...
A possible (nice) solution could be to create a custom tag that translates two letter country codes to three letter country codes. Which you could then use to set the IPTC tag with. It wouldn't be too difficult to do, just bit of work setting up the translation table (and maintaining it).
Another simpler solution would be to simply add a space to the two letter code and be done with it (that is, if exiftool doesn't chop off the space, I haven't tried this)
Title: Re: disappearance Country-Primary Location Code
Post by: Hayo Baan on September 09, 2015, 02:41:08 AM
Quote from: Hayo Baan on September 09, 2015, 02:15:01 AM
Well, it seems Adobe is simply violating the standard here...
A possible (nice) solution could be to create a custom tag that translates two letter country codes to three letter country codes. Which you could then use to set the IPTC tag with. It wouldn't be too difficult to do, just bit of work setting up the translation table (and maintaining it).
Another simpler solution would be to simply add a space to the two letter code and be done with it (that is, if exiftool doesn't chop off the space, I haven't tried this)

I created a simple custom tag to convert two letter codes to three letter codes. If you put the following into a ExifTool_config file you should be able to use it like so: exiftool -config ExifTool_config -xmp3lettercountrycode>iptc:Country-PrimaryLocationCode FILES. You will of course have to add any country code translations as necessary.
our %CCTranslate = (
    RU => 'RUS',
    NL => 'NLD',
    DE => 'DEU',
);

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        XMP3LetterCountryCode => {
            Require => {
                0 => 'CountryCode',
            },
            ValueConv =>
                '$Image::ExifTool::CCTranslate{$val[0]} || $val[0]',
        },
    },
);

(note: if the translation is not set, the code above uses the original (possibly two letter) code in place)

Hope this helps!
Title: Re: disappearance Country-Primary Location Code
Post by: StarGeek on September 09, 2015, 03:27:14 AM
Quote from: Hayo Baan on September 09, 2015, 02:15:01 AM
Well, it seems Adobe is simply violating the standard here...

It appears to just be a difference between the two standards.  The old IPTC Country-PrimaryLocationCode uses 3 characters.  According to this page (IPTC.org) (https://www.iptc.org/std/photometadata/documentation/GenericGuidelines/index.htm#!Documents/iptccoreimagesection.htm), the newer IPTC Core CountryCode uses 2 or 3 characters, with 2 characters being recommended (ISO 3166 (http://www.iso.org/iso/country_codes)).  The link on the IPTC page no longer works and the ISO info appears to only available through a javascript powered search (https://www.iso.org/obp/ui/#search/code/) (I think that link should work).  No nice and easy downloadable list that I can find.

edit:  Wikipedia appears to have the Alpha-3 codes (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3#Officially_assigned_code_elements) and Alpha-2 codes (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements). 

edit 2: The CIA has a full translation table (https://www.cia.gov/library/publications/the-world-factbook/appendix/appendix-d.html).  But then you'r...**insert your favorite conspiracy theory here**
Title: Re: disappearance Country-Primary Location Code
Post by: StarGeek on September 09, 2015, 03:50:47 AM
I found a csv country code list in this stack exchange post (http://gis.stackexchange.com/a/1091) and added it to Hayo's config.  Attached to this post.  I haven't tested it so I don't know if I screwed it up or not.  Also, it's possible that it's out of date since that post is five years old.
Title: Re: disappearance Country-Primary Location Code
Post by: Newsky on September 09, 2015, 05:07:37 AM
Hayo Baan thank you very much for the script, and thank you for a modification StarGeek. It works fine. But I would like, at this time if the relevant symbol and 2 and 3 in the symbol field Country-Primary Location Code is a well-would ExifTool is maintained.
Title: Re: disappearance Country-Primary Location Code
Post by: Phil Harvey on September 09, 2015, 08:32:52 AM
Maybe I should make this a minor warning so that adding the -m option will allow you to write the 2-character country codes to IPTC IIM (contrary to the IPTC spec).  This is what is currently done for values that are too long.

- Phil
Title: Re: disappearance Country-Primary Location Code
Post by: uffti on November 05, 2018, 04:54:37 AM
Hi !

It seems that 2 letter country codes are now definitely allowed in the Standard

http://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata#country-code-legacy (http://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata#country-code-legacy)

Enter the 2 or 3 letter ISO 3166 Country Code of the Country pictured in this image

The Warning

[Minor] String too short (minlen is 3) for IPTC:Country-PrimaryLocationCode

is not useful anymore.

Phil, could you please change the Exiftool Limits ?

Thank you, Mario
Title: Re: disappearance Country-Primary Location Code
Post by: Phil Harvey on November 05, 2018, 07:10:11 AM
Hi Mario,

You're reading the wrong specification.  The documentation you referenced applies to XMP-iptcCore:CountryCode, not IPTC:CountryCode.

- Phil