nikon – Handle Nikon sidecar files (read only)

Handle Nikon sidecar files (read only)

The sidecar.nikon module implements handlers for the Nikon sidecar file. The article named Inside Nikon Sidecar file details the data structure and tags used by Nikon.

Each set of XMP properties (sdc, ast, nine) have its own handlers to process that set. The NikonSideCar is the main class managing a Nikon sidecar file.

Using nikon

For this short tutorial, we have a sidecar file named ‘full_XMP.IPTC.NEF.nksc’. We create an instance of NikonSideCar).

>>> from sidecar.nikon import NikonSideCar
>>> from pathlib import Path
>>> path = Path('images_samples/NKSC_PARAM/full_XMP.IPTC.NEF.nksc')
>>> nksc = NikonSideCar(path)

We can parse the Nikon sidecar file to extract metadata.

>>> nksc.parse()

We can simply access th some key properties via methods as NikonSideCar.get_rating() or NikonSideCar.is_geotagged(). See NikonSideCar for an exhaustive list of methods.

>>> nksc.get_rating()
5
>>> nksc.get_label()
'Rose'
>>> nksc.is_geotagged()
True

We can list all the metadata parsed from the sidecar files. The following output has been truncated to fit in the page.

>>> for k, v in nksc.metadata.items():
...     print(f" * {k}: {v}")
 * appname: NX Studio
 * appversion: 1.10 W
 * xmp:Rating: 5
 * xmp:Label: Rose
 * dc:title: [Description] Titre
 * dc:subject: ['Mot-clé #1', 'Mot-clé #2', 'Mot-clé #3']
 ...
 * Iptc4xmpExt:Event: ['[Description] Evénement']

We can list all the image adjustement stored in the sidecar file. The following output has been truncated to fit in the page.

>>> for k, v in nksc.processing.items():
...     print(f" * {k}: Active={v.active}")
...     for n, p in v.params.items():
...         print(f"     * {n}: {p} ")
 * nikon::ColorShift: Active=False
     * colorCorrection: 0
 * nikon::PictureControl: Active=True
     * Export: b'NCP\x00\x00\x00\x00\x01\x00\x00\x00$0100STANDARD...'
     * SelectedPictureControl: 0
     * AutoContrast: 255
     * AutoSaturation: 255
     * SelectedPictureControlVersion2: 0
     * SavedPicConProcess: 1
     * PictureControl: 0
     ...

We can show the geolocation stored in the side file. The geolocation attribute is a NikonGPSProperties. As this class have a object.__repr__ method, only the GPS coordinates are printed. All GPS properties are in NikonGPSProperties.props. See NikonGPSProperties for a more detailled view of geolocation properties.

>>> nksc.geolocation
lat: 48.13672 (N) long: 1.64114 (W)
>>> nksc.geolocation.props['GPSLatitude']
48.13672002447976

Reference

Exception

exception darkbridge.sidecar.nikon.NikonError(message: str | None = '')

Bases: Exception

Base class for sidecar parser exceptions.

Parameters:

message – (optional) Human readable string describing the exception.

message

Human readable string describing the exception.

Type:

str | None

Sidecar object

class darkbridge.sidecar.nikon.NikonSideCar(path: Path)

Bases: object

Nikon Side car file.

This class parses a sidecar file to extract the metadata of the image on the one hand, and the image processing stack on the other. The NKSC files are in XML/XMP, so we walk in the RDF tree.

The article named “Inside Nikon Sidecar file” details the data structure and tags used by Nikon.

Parameters:

path – filesystem path of the Nikon Sidecar files containing the XMP Packet element.

metadata

unified dictionary of image metadata coming the Asteroid (ast) set.

Type:

dict | None

geolocation

object contains the geolocation of the image.

Type:

darkbridge.sidecar.nikon.NikonGPSProperties | None

processing

dictonary of image ajustements. The key active indicate if the processing will be applied on the image when opening in NX Studio. The key params contains processing’s parameters as a dictionnary.

Type:

dict | None

parse()

Parse the XMP Packet.

Raises:

NikonError – Generic error, the NikonError.message details the error.

_set_sdc_attr(xmp_property: NikonXMPProperty)

Set the SDC attribute expressed as an XMP property.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_ast_attr(xmp_property: NikonXMPProperty)

Set the AST attribute expressed as an XMP property.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_nine_attr(xmp_property: NikonXMPProperty)

Set the NINE attribute expressed as an XMP property.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_merge_metadata()

Merge the metadata sets.

Image metadata comes from the IPTC set (ast:IPTC element) and the XMP set (ast:XMLPackets). This method merge the two sets and store the metadata in metadata. The priority is the following order : IPTC, XMP.

The image label and rating may be defined in the nine set and in the XMP set (ast:XMLPackets). In the observed use cases, these properties in the nine set are always set to 0 (probably deprecated, but there is no public information). So the priority is the following order : XMP, Nine.

_set_processing()

Set the image adjustments.

This method simply copy image adjustments in processing.

_set_geoloc()

Set the geolocation of the image.

This method simply copy GPS data in geolocation.

get_rating() int

Return the image rating.

detail the param

get_label() int

Return the image label.

detail the param

is_protected() bool

Return True if the image is protected.

detail the param

is_geotagged() bool

Return True if the image have geolocation data.

detail the param

is_tagged() bool

Return True if the image have keywords.

detail the param

is_adjusted() bool

Return True if the image have image adjustment.

The method indicates if at least one image adjustment (filter) is active.

Todo

Reduire le spectre des filtres (lié aux traitement d’image)

is_cropped() bool

Return True if the image is cropped.

detail the param

is_perpective_adj() bool

Return True if the image have perspective adjusted.

detail the param

is_bw() bool

Return True if the image is monochrome (black and white).

detail the param

is_exposure_comp() bool

Return True if the image have its exposure adjusted.

detail the param

is_denoised() bool

Return True if the image have noise reduction.

detail the param

Properties objects

class darkbridge.sidecar.nikon.NikonSDCProperties

Bases: object

Nikon SDC properties container.

This class parse a sidecar file and extract sdc tags (namespace ‘http://ns.nikon.com/sdc/1.0/’). The properties read are copied into the attribute props which can contain the following entries:

  • appname: Name of the application that created the sidecar file.

  • appversion: Version identifier of the application that created the sidecar file.

The article named “Inside Nikon Sidecar file” details the data structure and tags used by Nikon.

about

Identifier of properties set. The identifier have to be nikon sidecar/1.0.

Type:

str | None

version

Version identifier of the sidecar format.

Type:

str | None

props

Dictionary of properties of the SDC set.

Type:

dict

get_xmp_props()

Returns the supported properties

This method provides the list of the supported XMP properties to populate the attribute classes.

Returns:

List of the supported properties. The property names are those of the XMP properties expressed in a short form (i.e. prefix:tag).

Return type:

list

set_attr(xmp_property: NikonXMPProperty)

Set the SDC attribute expressed as an XMP property.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_check_about(xmp_property: NikonXMPProperty)

Check the identifier of properties set.

The identifier have to be nikon sidecar/1.0.

Parameters:

xmp_property – Nikon XMP property containing data.

_check_version(xmp_property: NikonXMPProperty)

Check the version identifier of properties set.

The method simply read the version identifier as this attributes is not used.

Parameters:

xmp_property – Nikon XMP property containing data.

_set_appname(xmp_property: NikonXMPProperty)

Set the name of the application that created the sidecar file.

Parameters:

xmp_property – Nikon XMP property containing data.

_set_appversion(xmp_property: NikonXMPProperty)

Set the version of the application that created the sidecar file.

Parameters:

xmp_property – Nikon XMP property containing data.

class darkbridge.sidecar.nikon.NikonAsteroidProperties

Bases: object

Nikon Asteroid (AST) properties container.

This class parse a sidecar file and extract ast tags (namespace ‘http://ns.nikon.com/asteroid/1.0/’). The properties read are copied into the attribute props which can contain the following entries:

The article named “Inside Nikon Sidecar file” details the data structure and tags used by Nikon.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

about

Identifier of the sidecar file format. The identifier have to be core-asteroid-tags.

Type:

str | None

version

version identifier of the sidecar format (currently 11.0.0.3000)

Type:

str | None

props

Dictionary of properties of the AST set.

Type:

dict

_IPTC_XMP = {'2:05': 'dc:title', '2:101': 'photoshop:Country', '2:103': 'photoshop:TransmissionReference', '2:105': 'photoshop:Headline', '2:110': 'photoshop:Credit', '2:115': 'photoshop:Source', '2:116': 'dc:rights', '2:120': 'dc:description', '2:122': 'photoshop:CaptionWriter', '2:25': 'dc:subject', '2:40': 'photoshop:Instructions', '2:55': 'photoshop:DateCreated', '2:80': 'dc:creator', '2:85': 'photoshop:AuthorsPosition', '2:90': 'photoshop:City', '2:95': 'photoshop:State'}

Mapping IPTC properties to XMP properties, IPTC Specification defines the mapping.

_SUBJECTS = {'ACE': '1000000', 'CLJ': '2000000', 'DIS': '3000000', 'EDU': '5000000', 'EVN': '6000000', 'FIN': '4000000', 'HTH': '7000000', 'HUM': '8000000', 'LAB': '9000000', 'LIF': '10000000', 'POL': '11000000', 'REL': '12000000', 'SCI': '13000000', 'SOI': '14000000', 'SPO': '15000000'}

See Mapping Category Codes to Subject NewsCodes

_XMP_META = {'Iptc4xmpCore:CountryCode', 'Iptc4xmpCore:CreatorContactInfo', 'Iptc4xmpCore:IntellectualGenre', 'Iptc4xmpCore:Location', 'Iptc4xmpCore:Scene', 'Iptc4xmpCore:SubjectCode', 'Iptc4xmpExt:Event', 'MicrosoftPhoto:Rating', 'dc:creator', 'dc:description', 'dc:rights', 'dc:subject', 'dc:title', 'photoshop:AuthorsPosition', 'photoshop:CaptionWriter', 'photoshop:Category', 'photoshop:City', 'photoshop:Country', 'photoshop:Credit', 'photoshop:DateCreated', 'photoshop:Headline', 'photoshop:Instructions', 'photoshop:Source', 'photoshop:State', 'photoshop:SupplementalCategories', 'photoshop:TransmissionReference', 'photoshop:Urgency', 'xmp:Label', 'xmp:Rating', 'xmpRights:UsageTerms'}

Supported XMP metadata expressed as XMP properties. This list is subset of the XMP specification [ref] as observed from use cases

get_xmp_props()

Returns the supported properties

This method provides the list of the supported XMP properties to populate the attribute classes.

Returns:

List of the supported properties. The property names are those of the XMP properties expressed in a short form (i.e. prefix:tag).

Return type:

list

set_attr(xmp_property: NikonXMPProperty)

Set the AST attribute expressed as an XMP property.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_check_about(xmp_property: NikonXMPProperty)

Check the identifier of properties set.

The identifier have to be core-asteroid-tags.

Parameters:

xmp_property – Nikon XMP property containing data.

_check_version(xmp_property: NikonXMPProperty)

Check the version identifier of properties set.

The method simply read the version identifier as this attributes is not used.

Parameters:

xmp_property – Nikon XMP property containing data.

_set_xmlpacket(xmp_property: NikonXMPProperty)

Set the metadata of the image.

The image data are serialized in an embedded XML/XMP, so we walk in the RDF tree.

Parameters:

xmp_property – Nikon XMP property containing data.

_set_iptc(xmp_property: NikonXMPProperty)

Set the IPTC data expressed as an XMP binary property.

This method use the XMP name for the IPTC properties and not the IPTC name. It allows to have a unique naming referential

Datasets 2:15 “Category” and 2:20 “Supplemental Category” are deprecated, but both are still present in NX studio. These two fields were replaced in IIM version 4 by the Dataset 2:12 “Subject Reference” which must be populated by values from the Subject NewsCodes controlled (see Guideline for mapping Category Codes to Subject NewsCodes

Parameters:

xmp_property – Nikon XMP property containing IPTC data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_gps(xmp_property: NikonXMPProperty)

Set the GPS data expressed as an XMP property.

This method is called for each GPS attribute, so the GPS container is created during the first call and updated on following calls.

Parameters:

xmp_property – Nikon XMP property containing data.

class darkbridge.sidecar.nikon.NikonNineProperties

Bases: object

Nikon NINE properties container.

This class parse a sidecar file and extract nine tags (namespace ‘http://ns.nikon.com/nine/1.0/’).The properties read are copied into the attribute props which can contain the following entries:

  • NineEdits: dictionary of image’s adjustments.

  • Label: the image label

  • Rating: the image rating

The article named “Inside Nikon Sidecar file” details the data structure and tags used by Nikon.

Note

In the observed use cases, Label and Rating properties are

always set to 0 (probably deprecated, but there is no public information).

Raises:

NikonError – generic error, the NikonError.message details the error.

about

identifier of the sidecar file format. The identifier have to be nine-tags.

Type:

str | None

version

version identifier of the sidecar format (currently 2.0.0)

Type:

str | None

props

Dictionary of properties of the NINE set.

Type:

dict

get_xmp_props()

Returns the supported properties

This method provides the list of the supported XMP properties to populate the attribute classes.

Returns:

List of the supported properties. The property names are those of the XMP properties expressed in a short form (i.e. prefix:tag).

Return type:

list

set_attr(xmp_property: NikonXMPProperty)

Set the Nine attribute expressed as an XMP property.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_check_about(xmp_property: NikonXMPProperty)

Check the identifier of properties set.

The identifier have to be nikon sidecar/1.0.

Parameters:

xmp_property – Nikon XMP property containing data.

_check_version(xmp_property: NikonXMPProperty)

Check the version identifier of properties set.

The method simply read the version identifier as this attributes is not used.

Parameters:

xmp_property – Nikon XMP property containing data.

_set_nine_edits(xmp_property: NikonXMPProperty)

Set the NineEdits (aka adjustments) attribute.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

NikAdjustmentError – Generic error, the NikAdjustmentError.message details the error.

_set_label(xmp_property: NikonXMPProperty)

Set the label of the image.

Parameters:

xmp_property – Nikon XMP property containing data.

_set_rating(xmp_property: NikonXMPProperty)

Set the rating of the image.

The image data are serialized in an embedded XML/XMP, so we walk in the RDF tree.

Parameters:

xmp_property – Nikon XMP property containing data.

_ignore(xmp_property: NikonXMPProperty)

Do nothing.

Parameters:

xmp_property – Nikon XMP property containing data.

class darkbridge.sidecar.nikon.NikonGPSProperties

Bases: object

Nikon GPS properties container.

This class parse a sidecar file and extract ast tags (namespace ‘http://ns.nikon.com/asteroid/1.0/’) related to GPS Information. The properties read are copied into the attribute props which can contain the following entries:

  • GPSVersionID: The version of GPS information.

  • GPSLatitudeRef: Whether the latitude is north (N) or south (S).

  • GPSLatitude: The latitude, expressed in decimal degrees.

  • GPSLongitudeRef: Whether the longitude is east (E) or west (W).

  • GPSLongitude: The longitude, expressed in decimal degrees.

  • GPSAltitudeRef: The altitude used as the reference altitude in meters.

  • GPSAltitude: The altitude based on the reference in GPSAltitudeRef in meters.

  • GPSDateTimeStamp: The date and time, in UTC (Coordinated Universal Time).

  • GPSStatus: The status of the GPS receiver when the image is recorded.

    • A measurement is in progress

    • V measurement interrupted

  • GPSProcessingMethod: The name of the method used for location finding (GPS, CELLID, MANUAL).

  • GPSMapDatum: The geodetic survey data used by the GPS receiver. WGS-84 is used in most cases.

  • GPSSpeedRef: The unit used to express the GPSSpeed property.

    • K kilometers per hour

    • M miles per hour

    • N knots

  • GPSSpeed: The speed of GPS receiver movement.

  • GPSImgDirectionRef: The reference for giving the direction of the image when it is captured.

    • T true direction

    • M magnetic direction

  • GPSImgDirection: The direction of the image when it was captured. The range of values is from 0.00 to 359.99.

Note

Others GPS properties are ignored.

This class can be used in a formatted string and returns the latitude and longitude.

The article named Inside Nikon Sidecar file details the data structure and tags used by Nikon. In a nutshell, Nikon seems to have using DICOM specification (see GPS Attributes in NKSC files).

Raises:

ValueError – argument has the right type but an inappropriate value.

props

Dictionary of properties of the GPS location.

Type:

dict

get_xmp_props()

Returns the supported properties

This method provides the list of the supported XMP properties to populate the attribute classes.

Returns:

List of the supported properties. The property names are those of the XMP properties expressed in a short form (i.e. prefix:tag).

Return type:

list

set_attr(xmp_property: NikonXMPProperty)

Set the GPS attribute expressed as an XMP property.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_version(xmp_property: NikonXMPProperty)

Set the version of GPS information.

Parameters:

xmp_property – Nikon XMP property containing data.

_set_latitude_ref(xmp_property: NikonXMPProperty)

Set the latitude reference: north or south.

Whether the latitude is north (0) or south (1). This attribute do not match with the DICOM specifications [digps].

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_latitude(xmp_property: NikonXMPProperty)

Set the latitude.

The latitude expressed in degrees-minutes-seconds as a set of three floating number.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_longitude_ref(xmp_property: NikonXMPProperty)

Set the longitude reference: east or west.

Whether the longitude is east (2) or west # (3). This attribute do not match with the DICOM specifications [digps].

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_longitude(xmp_property: NikonXMPProperty)

Set the longitude.

The longitude expressed in degrees-minutes-seconds as a set of three floating number.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_altitude_ref(xmp_property: NikonXMPProperty)

Set the altitude reference.

Reference altitude in meters as a binary string.

Parameters:

xmp_property – Nikon XMP property containing data.

_set_altitude(xmp_property: NikonXMPProperty)

Set the altitude.

The altitude based on the reference in GPSAltitudeRef, in meters.

Parameters:

xmp_property – Nikon XMP property containing data.

_set_timestamp(xmp_property: NikonXMPProperty)

Set the time stamp.

The time in UTC (Coordinated Universal Time) expressed in hours-minutes-seconds as a set of three floating number. This attribute do not match with the DICOM specifications [digps].

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_datestamp(xmp_property: NikonXMPProperty)

Set the datetime stamp.

The date as a string in the format: YYYY:MM:DD. This attribute do not match with the DICOM specifications [digps].

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_status(xmp_property: NikonXMPProperty)

Set the status of the GPS receiver when the image is recorded.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_map_datum(xmp_property: NikonXMPProperty)

Set The geodetic survey data used by the GPS receiver.

Parameters:

xmp_property – Nikon XMP property containing data.

_set_processing(xmp_property: NikonXMPProperty)

Set the name of the method used for location finding.

The name of the method used for location finding as a set of two fixed strings ended by NULL characters.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_speed_ref(xmp_property: NikonXMPProperty)

Set The unit used to express the GPSSpeed.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_speed(xmp_property: NikonXMPProperty)

Set the speed of GPS receiver movement.

Parameters:

xmp_property – Nikon XMP property containing data.

_set_img_direction_ref(xmp_property: NikonXMPProperty)

Set the reference for giving the direction of the image.

Parameters:

xmp_property – Nikon XMP property containing data.

Raises:

ValueError – Inappropriate value, the ValueError.message details the error.

_set_img_direction(xmp_property: NikonXMPProperty)

Set the direction of the image.

Parameters:

xmp_property – Nikon XMP property containing data.

_ignore_bearing(xmp_property: NikonXMPProperty)

Do nothing.

Bearing GPS properties are is ignored as it contains the same information as Image Direction.

Parameters:

xmp_property – Nikon XMP property containing data.

_from_dms(dms: list[float])

Get coordinate in decimal degrees.

The method convert a coordinate expressed in degrees-minutes-seconds in decimal degrees. This method can accept one to three float.

Parameters:

dms – coordinate expressed in degrees-minutes-seconds as a set of one to three float.

Returns:

coordinate in decimal degrees .

Return type:

float

is_completed() bool

Indicates a minimum of properties is present.

The choice is a latitude and a longitude. The other properties as GPS references or altitude are optional.

Returns:

True if at least latitude and longitude is present.

class darkbridge.sidecar.nikon.NikonXMPProperty(element: Element)

Bases: object

Nikon XMP property.

This class parses an XML element as a XMP property and decode the resource. The resource may be a simple text , a structured data identified with the rdf:parseType attribute, or an array (see section 7.3 to 7.9 [adxmp1])

The article named “Inside Nikon Sidecar file” details the data structure and tags used by Nikon.

Parameters:

element – Element containing the property.

Raises:

NikonError – Generic error, the NikonError.message details the error.

name

Name of the property.

Type:

str

value

Value of the property, the type of the attribute depends on the resource type (binary, double,…).

Type:

None | str | list[float | None] | int | bytes

_set_array(element: Element)

Set an array.

The XMP specifications defines three type of array (section 6.3.4 [adxmp1]). This method store the array item in a list.

Parameters:

element – Element containing the property.

_set_simple(element: Element)

Set a simple value.

Parameters:

element – Element containing the property.

_set_binary(value: str)

Set a binary resource.

Parameters:

value – Value of the resource expressed as binary string encoded in base64 .

_set_long(value: str)

Set an integer resource.

Parameters:

value – Value of resource expressed as binary string encoded in base64 .

_set_double(value: str)

Set float number resource.

The value may define one or more float number (IEEE754 Double precision 64-bits). All numbers are simply concatenated with no separators.

Parameters:

value – Value of resource expressed as binary string encoded in base64 .

_set_ascii(value: str)

Set ACSII string resource.

Parameters:

value – Value of resource expressed as binary string encoded in base64 .

_set_gps_processing_method(value: str)

Set GPSProcessingMethod resource (proprietary format…).

Parameters:

value – Value of integer resource expressed as binary string encoded in base64 .

_set_dict(element: Element)

Set structure valued resource.

Parameters:

element – Element containing the property.

class darkbridge.sidecar.nikon.NikonXMPDescriptions(element: Element)

Bases: object

Manage the XMP Packet header description

This class parses an XMP Packet and checks its structure. In case of error and NikonError exception is raised. descriptions attribute contains the list of description block. For the observed use case, there is only description block per sidecar file.

The article named “Inside Nikon Sidecar file” details the data structure and tags used by Nikon.

Parameters:

element – XML element containing the XMP Packet with its wrapper( xpacket) as an XML processing instruction.

xmptk

Name of the xmp toolkit used to build the sidecar files.

Type:

str | None

descriptions

List of ElementTree.Element containing XMP description block identified by the rdf:Description element.

Type:

list[xml.etree.ElementTree.Element] | None

Raises:

NikonError – Generic error, the NikonError.message details the error.

_check_xmp_packet()

Check the XMP metadata marker

This method checks the XMP Packet identified by a rdf:RDF element (section 7.4 [adxmp1]). The method set the _element attribute to rdf:RDF element in the XML tree. An x:xmpmeta element may be placed around the rdf:RDF element (aka XMP Packet - see section 7.3.3 [adxmp1]) with name of the toolkit (x:xmptk) as attribute. This value is saved in xmptk.

Raises:

NikonError – Generic error, the NikonError.message details the error.

_set_xmp_descriptions()

Set the XMP descriptions attributes

This method checks the XMP description identified by a rdf:Description element (section 7.4 [adxmp1]). The method set the descriptions attribute.

Raises:

NikonError – Generic error, the NikonError.message details the error.

Constants

darkbridge.sidecar.nikon.NIKON_SUPPORTED_FORMAT = ['.nef', '.nrw', '.jpg', '.jpeg', '.tif', '.tiff', '.hif', '.nefx', '.mpo']

File extensions of supported image files.

darkbridge.sidecar.nikon.NIKON_NKSC_SUBFOLDER = 'NKSC_PARAM'

Subfolder storing the Nikon sidecar files.

darkbridge.sidecar.nikon.NIKON_NKSC_EXT = '.nksc'

File extension of Nikon sidecar files.

darkbridge.sidecar.nikon.NIKON_LABEL_MAP = {'0': '(Aucune)', '1': 'Red', '2': 'Orange', '3': 'Yellow', '4': 'Green', '5': 'Cyan', '6': 'Blue', '7': 'Purple', '8': 'Magenta', '9': 'Pink'}

Mapping between Nikon Label and XMP label expressed as a text. This table is based on default value and do not consider any customization. See Nikon, [Labels], Options > [Labels]