$ cd /Users/joe/Pictures/Photos Library.photoslibrary/Masters/2017/10/01 $ tree . ├── 20171001-173237 │ └── IMG_3089.JPG ├── 20171001-173238 │ └── IMG_3097.JPG ├── 20171001-173239 │ └── IMG_3094.JPG ├── 20171001-173240 │ └── IMG_3098.JPG └── 20171001-173241 └── IMG_3099.JPG
$ cd ~/nobackup $ mix new ecode
$ cd ecode $ tree . ├── README.md ├── config │ └── config.exs ├── lib │ └── ecode.ex ├── mix.exs └── test ├── ecode_test.exs └── test_helper.exs
defp deps do [ {:exif, github: "pragdave/exexif", app: false}, ] end
$ cd ~/ecode $ mix deps.get $ mix deps.compile
$ mkdir ~/noback/exif $ cd ~/nobackup/exif $ cp ~/Pictures/Photos\ Library.photoslibrary/\ Masters/2017/10/01/20171001-173237/IMG_3089.JPG test.jpg
$ cd ~/nobackup/exif $ cat test1.erl -module(test1). -compile(export_all). load() -> code:add_path("/usr/local/Cellar/elixir/1.5.1/lib/elixir/ebin/"), code:add_path("../ecode/_build/dev/lib/exif/ebin/"), application:start(compiler), application:start(elixir). test() -> io:format("~p~n",['Elixir.Exexif':exif_from_jpeg_file(<<"./test.jpg">>)]).
$ cd ~/nobackup/exif $ erl 1> c(test1). {ok, test1} 1> test1:load(). ok 2> test1:test(). {ok,#{exif => #{aperture_value => 2.275,brightness_value => 1.045, color_space => <<"sRGB">>, component_configuration => <<"Y,Cb,Cr,-">>, datetime_original => <<"2017:09:30 14:16:26">>, ... gps => #{gps_area_information => nil, gps_latitude_ref => <<"N">>, ... gps_latitude => [59,53,56.11], ...
image_info(File) -> {ok, I} = 'Elixir.Exexif':exif_from_jpeg_file(File), #{exif := E, gps := G, orientation := O} = I, #{datetime_original := Time, exif_image_height := Ht, exif_image_width := Width} = E, #{gps_latitude := Lat, gps_longitude := Long } = G, #{time => Time, ht => Ht, width => Width, orientation => O, latitude => Lat, longitude => Long }.
> test1:test1(). #{ht => 2448, latitude => [59,53,56.11], longitude => [17,37,50.88], orientation => <<"Rotate 90 CW">>, time => <<"2017:09:30 14:16:26">>,width => 3264}
A B