Project

General

Profile

Support #990

Get tag type from key

Added by Thomas Beutlich over 4 years ago. Updated almost 4 years ago.

Status:
Closed
Priority:
Normal
Category:
design
Target version:
Start date:
05 Sep 2014
Due date:
% Done:

0%

Estimated time:

Description

In the addmodel sample there is the type knowledge given at compile time e.g. tag Exif.Image.PrimaryChromaticities is of tag type Exiv2::URationalValue. Now assume that only the key name is given but the tag type is not known a priori. Is there any chance to retrieve the type info from the TagInfo structure?

History

#1

Updated by Robin Mills over 4 years ago

  • Category set to design
  • Status changed from New to Assigned
  • Assignee set to Robin Mills
  • Target version set to 0.25

Thomas

Can you help me to understand your expectation here. Are you requesting an option for Exiv2(.exe) to list all known tags and their data types? Currently, exiv2(.exe) reports data type and value. However it only lists tag, type and value when used in an image.

Or do you want something changed in addmoddel.cpp to report data type?

Robin

#2

Updated by Thomas Beutlich over 4 years ago

Robin,

what I would need is the tag type of any tag (not yet necessary in the image) at run-time. In the addmodel sample there is redundant knowledge that tag Exif.Image.PrimaryChromaticities is of tag type Exiv2::URationalValue. But say a user wants to add any tag at rum-time how do I find out its tag type? Basically I then need to write a switch/case on the tag type to consider all different types. Is this possible?

Regards,
Thomas

#3

Updated by Andreas Huggel over 4 years ago

Thomas, I think you're looking for ExifKey::defaultTypeId(). For your example (user wants to add tag at run-time but doesn't know its type) you don't need to use that though:

exifData["Exif.Image.PrimaryChromaticities"] = "1"

creates an Exifdatum without a value and the assignment operator calls Exifdatum::setValue(), which creates a value of the default type for the Exifdatum.

Andreas

#4

Updated by Thomas Beutlich over 4 years ago

Indeed, that is what I was looking for. Thank you!

Exiv2::ExifKey key = Exiv2::ExifKey("Exif.Image.PrimaryChromaticities");
Exiv2::TypeId typeId = key.defaultTypeId();

Ticket can be closed.

#5

Updated by Robin Mills over 4 years ago

  • Status changed from Assigned to Resolved
  • Assignee changed from Robin Mills to Andreas Huggel

I'm going to mark this as "Resolved". It'll be Closed during review as part of the v0.25 release process.

I've also assigned this to Andreas as he's the guy who's provided the solution. Thanks, Andreas.

#6

Updated by Andreas Huggel almost 4 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF