xmp {xmpdf} | R Documentation |
XMP metadata object
Description
xmp()
creates an XMP metadata object.
Such objects can be used with set_xmp()
to edit XMP medata for a variety of media formats
and such objects are returned by get_xmp()
.
Usage
xmp(
...,
alt_text = NULL,
attribution_name = NULL,
attribution_url = NULL,
create_date = NULL,
creator = NULL,
creator_tool = NULL,
credit = NULL,
date_created = NULL,
description = NULL,
ext_description = NULL,
headline = NULL,
keywords = NULL,
license = NULL,
marked = NULL,
modify_date = NULL,
more_permissions = NULL,
producer = NULL,
rights = NULL,
subject = NULL,
title = NULL,
usage_terms = NULL,
web_statement = NULL,
auto_xmp = c("cc:attributionName", "cc:license", "dc:rights", "dc:subject",
"photoshop:Credit", "xmpRights:Marked", "xmpRights:UsageTerms",
"xmpRights:WebStatement"),
spdx_id = NULL
)
Arguments
... |
Entries of xmp metadata. The names are either the xmp tag names or alternatively the xmp namespace and tag names separated by ":". The values are the xmp values. |
alt_text |
Brief textual description that can be used as its "alt text" (XMP tag |
attribution_name |
The name to be used when attributing the work (XMP tag |
attribution_url |
The URL to be used when attributing the work (XMP tag |
create_date |
The date the digital document was created (XMP tag |
creator |
The document's author(s) (XMP tag |
creator_tool |
The name of the application that originally created the document (XMP tag |
credit |
Credit line field (XMP tag |
date_created |
The date the intellectual content was created (XMP tag |
description |
The document's subject (XMP tag |
ext_description |
An extended description (for accessibility)
if the "alt text" is insufficient (XMP tag |
headline |
A short synopsis of the document (XMP tag |
keywords |
Character vector of keywords for this document (for cross-document searching).
Related pdf documentation info key is |
license |
The URL of (open source) license terms (XMP tag |
marked |
Whether the document is a rights-managed resource (XMP tag |
modify_date |
The date the document was last modified (XMP tag |
more_permissions |
A URL for additional permissions beyond the |
producer |
The name of the application that converted the document to pdf (XMP tag |
rights |
(copy)right information about the document (XMP tag |
subject |
List of description phrases, keywords, classification codes (XMP tag |
title |
The document's title (XMP tag |
usage_terms |
A string describing legal terms of use for the document (XMP tag |
web_statement |
Web Statement of Rights (XMP tag |
auto_xmp |
Character vector of XMP metadata we should try to automatically determine
if missing from other XMP metadata and |
spdx_id |
The id of a license in the SPDX license list. See spdx_licenses. |
Value
An xmp object as can be used with set_xmp()
. Basically a named list whose names are the (optional) xmp namespace and tag names separated by ":" and the values are the xmp values.
Datetimes should be a datetime object such as POSIXlt()
.
xmp
R6 Class Methods
fig_process(..., auto = c("fig.alt", "fig.cap", "fig.scap"))
-
Returns a function to embed XMP metadata suitable for use with
{knitr}
'sfig.process
chunk option....
are local XMP metadata changes for this function.auto
are which chunk options should be used to further update metadata values. get_item(key)
Get XMP metadata value for key
key
. Can also use the relevant active bindings to get more common values.print(mode = c("null_omit", "google_images", "creative_commons", "all"), xmp_only = FALSE)
-
Print out XMP metadata values. If
mode
is "null_omit" print out which metadata would be embedded. Ifmode
is "google images" print out values for the five fields Google Images uses. Ifmode
iscreative_commons
print out the values for the fields Creative Commons recommends be set when using their licenses. If mode isall
print out values for all XMP metadata that we provide active bindings for (even ifNULL
). Ifxmp_only
isTRUE
then don't print outspdx_id
andauto_xmp
values. set_item(key, value)
Set XMP metadata key
key
with valuevalue
. Can also use the relevant active bindings to set XMP metadata values.update(x)
Update XMP metadata entries using non-
NULL
entries inx
coerced byas_xmp()
.
xmp
R6 Active Bindings
alt_text
The image's alt text (accessibility).
attribution_name
The name to attribute the document.
attribution_url
The URL to attribute the document.
create_date
The date the document was created.
creator
The document's author.
creator_tool
The name of the application that originally created the document.
credit
Credit line.
date_created
The date the document's intellectual content was created
description
The document's description.
ext_description
An extended description for accessibility.
headline
A short synopsis of document.
keywords
String of keywords for this document (less popular than
subject
)).license
URL of (open-source) license terms the document is licensed under.
marked
Boolean of whether this is a rights-managed document.
modify_date
The date the document was last modified.
more_permissions
URL for acquiring additional permissions beyond
license
.producer
The name of the application that converted the document (to pdf).
rights
The document's copy(right) information.
subject
Vector of key phrases/words/codes for this document (more popular than
keywords
)).title
The document's title.
usage_terms
The document's rights usage terms.
web_statement
A URL string for the web statement of rights for the document.
spdx_id
The id of a license in the SPDX license list. See spdx_licenses.
auto_xmp
Character vector of XMP metadata we should try to automatically determine if missing from other XMP metadata and
spdx_id
.
XMP tag recommendations
-
https://exiftool.org/TagNames/XMP.html recommends "dc", "xmp", "Iptc4xmpCore", and "Iptc4xmpExt" schemas if possible
-
https://github.com/adobe/xmp-docs/tree/master/XMPNamespaces are descriptions of some common XMP tags
-
https://www.iptc.org/std/photometadata/specification/IPTC-PhotoMetadata#xmp-namespaces-and-identifiers is popular for photos
-
https://developers.google.com/search/docs/appearance/structured-data/image-license-metadata#iptc-photo-metadata are the subset of IPTC photo metadata which Google Photos uses (if no structured data on web page)
-
https://wiki.creativecommons.org/wiki/XMP are Creative Commons license recommendations
See Also
get_xmp()
and set_xmp()
for getting/setting such information from/to a variety of media file formats.
as_xmp()
for coercing to this object.
as_docinfo()
can be used to coerce xmp()
objects into docinfo()
objects.
Examples
x <- xmp(attribution_url = "https://example.com/attribution",
creator = "John Doe",
description = "An image caption",
date_created = Sys.Date(),
spdx_id = "CC-BY-4.0")
print(x)
print(x, mode = "google_images", xmp_only = TRUE)
print(x, mode = "creative_commons", xmp_only = TRUE)
if (supports_set_xmp() &&
supports_get_xmp() &&
capabilities("png") &&
requireNamespace("grid", quietly = TRUE)) {
f <- tempfile(fileext = ".png")
png(f)
grid::grid.text("This is an image!")
invisible(dev.off())
set_xmp(x, f)
print(get_xmp(f)[[1]])
}