Ironholds / exif

Read exif data into R
Other
10 stars 3 forks source link

exif seems unhappy with ~ in paths (on OSX at least) #1

Closed dill closed 8 years ago

dill commented 8 years ago

It seems like if I include a ~ in a path, things go wrong:

> exif::read_exif("~/Dropbox/Photos/legoland/IMG_5041.JPG")
Error: Can't open file: ~/Dropbox/Photos/legoland/IMG_5041.JPG

But relative paths seem fine:

> getwd()
[1] "/Users/dill/Dropbox/Photos/legoland"
> exif::read_exif("IMG_5041.JPG")
   make     model software bits_per_sample image_width image_height description
1 Apple iPhone 4S    7.1.2               0        3264         2448
  orientation copyright           timestamp    origin_timestamp
1           6           2015:07:05 10:39:09 2015:07:05 10:39:09
  digitised_timestamp subsecond_timestamp exposure_time f_stop iso_speed
1 2015:07:05 10:39:09                 204          2404    2.4        50
  subject_distance exposure_bias used_flash metering focal_length
1                              0      FALSE        3         4.28
  focal_length_35mm latitude longitude altitude lens_min_focal_length
1                35 55.73641  9.123783 60.00003                  4.28
  lens_max_focal_length lens_min_f_stop lens_max_f_stop lens_make
1                  4.28             2.4             2.4     Apple
                          lens_model
1 iPhone 4S back camera 4.28mm f/2.4

The following also seems fine:

> getwd()
[1] "/Users/dill/Dropbox/Photos"
> exif::read_exif("legoland/IMG_5041.JPG")
   make     model software bits_per_sample image_width image_height description
1 Apple iPhone 4S    7.1.2               0        3264         2448
  orientation copyright           timestamp    origin_timestamp
1           6           2015:07:05 10:39:09 2015:07:05 10:39:09
  digitised_timestamp subsecond_timestamp exposure_time f_stop iso_speed
1 2015:07:05 10:39:09                 204          2404    2.4        50
  subject_distance exposure_bias used_flash metering focal_length
1                              0      FALSE        3         4.28
  focal_length_35mm latitude longitude altitude lens_min_focal_length
1                35 55.73641  9.123783 60.00003                  4.28
  lens_max_focal_length lens_min_f_stop lens_max_f_stop lens_make
1                  4.28             2.4             2.4     Apple
                          lens_model
1 iPhone 4S back camera 4.28mm f/2.4

Any ideas?

Ironholds commented 8 years ago

Hmn; looks like fopen doesn't like shorthand for paths. I'll experiment with path expansion using normalizePath; this should be easily fixable.