Convert image file formats while preserving EXIF data
uas_convert(
x,
dir_out = NULL,
idx = NULL,
format_out = c("jpg", "tif")[1],
quality = 90,
copy_exif = TRUE,
overwrite = FALSE,
quiet = FALSE
)
A vector of filenames (with path), or an object of class 'uas_info'
The output directory(s)
Row numbers of the images (optional)
The output format
The quality level for jpg compression (0..100), larger numbers produce better image quality
Whether to copy the original EXIF info to the new file, logical
Overwrite existing files, logical
Suppress messages, logical
This function converts image formats. Images are converted using the `magick` package (which calls ImageMagick libraries), while EXIF data is copied using exiftool. Supported output formats include JPG and TIFF.
x
can be a vector of image file names (including the path), or a image metadata object (created by uas_info
). If idx
(row numbers) is passed, it will be used to select images to convert.
dir_out
is the name of the directory where converted images will be output. If NULL, images will be placed in the same
directory as the input images. If x
is an object of class `uas_info`, dir_out
can be a vector of directories equal in length to the number of folders
indexed in x
(in which case the converted images will be placed in the corresponding output directory).
quality
sets the compression ratio for jpg images. To preserve a high level of fidelity and improve the odds of successful stitching, it
is recommended you set quality
to 90 or higher. If format_out = "tif"
, the output files will be saved as uncompressed tif files.
if (FALSE) {
## Make a list of DNG files to convert
files_dng <- list.files("D:/uas/mavic_pro/raw",
pattern = ".DNG$",
full.names = TRUE,
ignore.case = TRUE)
uas_convert(files_dng,
dir_out = "D:/uas/mavic_pro/jpg",
format_out = "jpg")
}