-
Notifications
You must be signed in to change notification settings - Fork 3
/
README.Rmd
115 lines (78 loc) · 2.14 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
---
output: rmarkdown::github_document
---
```{r message=FALSE, warning=FALSE, error=FALSE, include=FALSE}
knitr::opts_chunk$set(message=FALSE, warning=FALSE, fig.retina=2)
options(width=120)
```
# exiv
## Description
Read and Write 'Exif', 'ID3v1' and 'ID3v2' Image/Media Tags
### README FIRST!!!
This package shld work on macOS and Linux systems that have the [`exiv2`](http://www.exiv2.org/) and [`taglib`](https://github.com/taglib/taglib) packages installed:
- macOS: `brew install taglib exiv2`
- Ubuntu/Debian `sudo apt-get install libexiv2-dev exiv2 libtag1-dev`
For the time being, they need to be easily findable. It'll be more robust when the pkg is out of Alpha status.
ONLY "Standard" Exif TAGS ARE SUPPORTED FOR THE MOMENT.
Value Exif types currently supported:
- `ascii`
- `long`
- `short`
- `rational`
- `srational`
- `comment`
## What's Inside The Tin
The following functions are implemented:
- `read_exif`: Retrieve Exif data from an image file
- `set_exif`: Set Exif tag data on an image file
- `exif_tags`: Return a data frame of all possible Exif tags
## Installation
```{r eval=FALSE}
devtools::install_github("hrbrmstr/exiv")
```
## Usage
```{r}
library(exiv)
library(tidyverse)
# current verison
packageVersion("exiv")
```
### Tags, you say?
We got your tags, _right here_:
```{r}
exif_tags(filter_type="ascii")
```
### Read exif data
This shld be an empty data frame:
```{r}
r_logo <- system.file("extdata", "Rlogo.png", package="exiv")
read_exif(r_logo)
```
Let's move it and add some ASCII metadata!
```{r}
tf <- tempfile(fileext=".png")
file.copy(r_logo, tf)
set_exif(tf, "Exif.Image.ProcessingSoftware", "The incredibly unassuming exiv R package!")
```
Just to prove we did it:
```{r}
read_exif(tf)
```
Can I have another, then?
```{r}
set_exif(tf, "Exif.Image.ImageDescription", "The R logo. Duh!")
```
There should be two now!
```{r}
read_exif(tf)
```
Some numerics:
```{r}
set_exif(tf, "Exif.Image.ImageWidth", 1000)
set_exif(tf, "Exif.Image.RatingPercent", 30)
set_exif(tf, "Exif.Image.YResolution", c(-2, 3))
set_exif(tf, "Exif.Photo.DateTimeOriginal", as.character(Sys.time()))
```
```{r include=FALSE}
unlink(tf)
```