Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exif library for Erlang

Read exif info from JPG image.

Usage

Read Exif from binary data

If You have JPG image as binary data, use exif:read_binary/1.

Result is a proplist of Exif tags. Key is Exif tag (integer), value where:

  • integer is integer value,
  • {integer, integer} is relal (float) value
  • binary is string or raw value

Exmple:

1> {ok, Bin} = file:read_file("1741207742272.jpg").
{ok,<<255,216,255,225,101,100,69,120,105,102,0,0,73,73,
      42,0,8,0,0,0,10,0,1,1,4,0,1,...>>}
2> exif:read_binary(Bin).
{ok,[{257,4080},
     {274,1},
     {283,{72,1}},
     {282,{72,1}},
     {256,3072},
     {305,<<"MediaTek Camera Application">>},
     {270,<<>>},
     {531,2},
     {34665,214},
     {296,2}]}

Meaning of Exif tags is in the specification.

Read Exif from binary file

The same, but data is readed from file. It reads only first 64k bytes (not whole file) and if it is not enougth, then it reads next blocks.

3> exif:read_file("1741207742272.jpg").            
{ok,[{257,4080},
     {274,1},
     {283,{72,1}},
     {282,{72,1}},
     {256,3072},
     {305,<<"MediaTek Camera Application">>},
     {270,<<>>},
     {531,2},
     {34665,214},
     {296,2}]}

Datetime decoding

If Exif has datetime (tag 306), then get it and try to parse it.

It was tested and developed on large set of images with different and strange datetime formats.

1> {ok, ExifInfo} = exif:read_file("109_0645.JPG").

2> exif:exif_datetime(ExifInfo).`
{ok,{{2025,7,19},{12,40,25}}}

Specification

Based on Exif 2.2.

Copy can be found in

doc/Exif2-2.PDF

Build

  $ rebar compile

Author

Alois Vitásek avitasek@seznam.cz

About

Erlang library for exif

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages