Giter Club home page Giter Club logo

exexif's Introduction

Exexif

Read TIFF and EXIF information from a JPEG-format image.

Retrieve data from a file:

iex> {:ok, info} = Exexif.exif_from_jpeg_file(path)

Retrieve data from a binary containing the JPEG (you don't need the whole thing—the exif is near the beginning of a JPEG, so 100k or so should do fine).

iex> {:ok, info} = Exexif.exif_from_jpeg_buffer(buffer)

Access the high level TIFF data:

iex> info.x_resolution
72
iex> info.model
"DSC-RX100M2"

The exif data is in there, too.

iex> info.exif.color_space
"sRGB"
iex> info.exif |> Dict.keys
[:brightness_value, :color_space, :component_configuration,
 :compressed_bits_per_pixel, :contrast, :custom_rendered, :datetime_original,
 :datetime_digitized, :digital_zoom_ratio, :exif_image_height,
 :exif_image_width, :exif_version, :exposure_bias_value, :exposure_mode,
 :exposure_program, :exposure_time, :f_number, :file_source, :flash,
 :flash_pix_persion, :focal_length, :focal_length_in_35mm_film,
 :iso_speed_ratings, :lens_info, :light_source, :max_aperture_value,
 :metering_mode, :recommended_exposure, :saturation, :scene_capture_type,
 :scene_type, :sensitivity_type, :sharpness, :white_balance]

GPS data is in there, too (if presented in EXIF, of course.)

iex> {:ok, info} = Exexif.exif_from_jpeg_file("test/images/sunrise.jpg")
{:ok,
 %{exif: %{color_space: "Uncalibrated", exif_version: "2.10", ...},
   gps: %Exexif.Data.Gps{gps_altitude: 47, gps_altitude_ref: 0, ...},
   make: "ulefone", model: "Power", modify_date: "\"2016:12:28 14:04:48\"",
   orientation: "Horizontal (normal)", resolution_units: "Pixels/in",
   x_resolution: 72, y_resolution: 72}}

iex> info.gps.gps_latitude
[41, 23, 16.019]

iex> "#{info.gps}"
"41°23´16˝N,2°11´50˝E"

Todo

The exif tag list is missing some of the newer entries. Contributions welcome.

License and Copyright

See LICENSE.md

exexif's People

Contributors

mertonium avatar orthogonous avatar pragdave avatar remvee avatar sztheory avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

exexif's Issues

Would you mind pushing 0.0.3 to hex.pm?

Hello and thank you so much for this lib!

I had some trouble getting it running locally and then realized that the package I got from hex is still at 0.0.1.

Everything worked wonderfully once I changed my mix.exs to {:exexif, git: "[email protected]:pragdave/exexif.git"} but I thought I'd flag the discrepancy so others don't get caught out.

I'm pretty sure mix hex.publish is all that needs to be run since exexif's mix.exs has the updated version number.

Again, thanks for the hard work!

Some jpeg with correct exif information don't get recognized

I guess you already know about this. but I wouldn't want to leave without commenting.
This is an example jpeg file with valid exif information (according to exiftool ), but when parsing with exexif I get {:error, :no_exif_data_in_jpeg}. Reading the source code and the first bytes of the file that is no surprise at all.

I wish I had the time to learn more about image encodings in order to send you a patch :)

Invalid value for orientation (0)

I was testing this library with a file taken by an LG-H440n device, and it gave the following error.

** (FunctionClauseError) no function clause matching in Exexif.Decode.orientation/1    
    
    The following arguments were given to Exexif.Decode.orientation/1:
    
        # 1
        0
    
    Attempted function clauses (showing 8 out of 8):
    
        defp orientation(1)
        defp orientation(2)
        defp orientation(3)
        defp orientation(4)
        defp orientation(5)
        defp orientation(6)
        defp orientation(7)
        defp orientation(8)
    
    (exexif 0.0.5) lib/exexif/decode.ex:103: Exexif.Decode.orientation/1
    (exexif 0.0.5) lib/exexif/decode.ex:13: Exexif.Decode.tag/3
    (exexif 0.0.5) lib/exexif.ex:111: Exexif.read_tags/5
    (exexif 0.0.5) lib/exexif.ex:67: Exexif.read_exif/1

The issue is because the orientation value is 0, that appears to be related with this.

Should this library accept orientation(0)?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.