edit_xmp {xmpdf} | R Documentation |
Set/get xmp metadata
Description
get_xmp()
gets xmp metadata from a file.
set_xmp()
sets xmp metadata for a file.
Usage
get_xmp(filename, use_names = TRUE)
get_xmp_exiftool(filename, use_names = TRUE)
set_xmp(xmp, input, output = input)
set_xmp_exiftool(xmp, input, output = input)
Arguments
filename |
Filename(s) to extract xmp metadata from. |
use_names |
If |
xmp |
An |
input |
Input filename. |
output |
Output filename. |
Details
get_xmp()
will try to use the following helper functions in the following order:
-
get_xmp_exiftool()
which wrapsexiftool
command-line tool
set_xmp()
will try to use the following helper functions in the following order:
-
set_xmp_exiftool()
which wrapsexiftool
command-line tool
Value
get_xmp()
returns a list of xmp()
objects.
set_xmp()
returns the (output) filename invisibly.
See Also
xmp()
for more information about xmp metadata objects.
supports_get_xmp()
, supports_set_xmp()
, and supports_exiftool()
to detect support for these features. For more info about xmp metadata see https://www.exiftool.org/TagNames/XMP.html.
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]])
}