Giter Club home page Giter Club logo

exiv2's Introduction

Exiv2

License MIT Gem Version Gem Downloads Build Status

A simple wrapper around the C++ Exiv2 libary for reading and writing image metadata.

See http://www.exiv2.org/

Requires that the exiv2 C++ library is installed.

Usage

gem install exiv2

If you are on new version of Command Line Tool (that is newer than 6.2, and bump into following error:

/Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/iterator:341:10: fatal error: '__debug' file not found
#include <__debug>

You can follow the quick hack by touching a new file /Library/Developer/CommandLineTools/usr/include/c++/v1/__debug with content:

#ifndef _LIBCPP_ASSERT
#define _LIBCPP_ASSERT(...) ((void)0)
#endif

Once everything is successfully installed, you can give it a go:

require 'exiv2'
image = Exiv2::ImageFactory.open("image.jpg")
image.read_metadata
image.iptc_data.each do |key, value|
  puts "#{key} = #{value}\n"
end
image.exif_data.each { ... }
image.xmp_data.each { ... }

iptc_data_hash  = image.iptc_data.to_hash
xmp_data_hash   = image.xmp_data.to_hash

image.exif_data.delete("Exif.Image.Software")
image.iptc_data.delete_all("Iptc.Application2.Keywords")

image.iptc_data["Iptc.Application2.Caption"] = "A New Caption"
image.iptc_data.add("Iptc.Application2.Keywords", "fishy")

image.write_metadata

Why?

None of the existing Ruby libraries for reading and writing image metadata did quite what we wanted, so we figured it wouldn't be too hard to wrap enough of Exiv2 to meet our needs.

The intention is to just mirror the Exiv2 API in Ruby, so the path to extending this to support more of Exiv2's functionality should be straightforward. Patches are welcome.

Compatibility

Tested on 2.6.x, 2.7.x, 3.0.x, 3.1.x and 3.2.x with Exiv2 0.27.1 and 0.28.0.

Developing

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it. This is important so I don't break it in a future version unintentionally.
  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  • Send me a pull request. Bonus points for topic branches.

Status

In early development. Very little of Exiv2's API is supported, and it hasn't been heavily tested.

Contributors

Pete Yandell, Mark Turnley, Lucas Parry, Norbert Wojtwoicz, Jan Graichen, John Barton

Copyright

Copyright (c) 2014 Envato & Pete Yandell. See LICENSE for details.

exiv2's People

Contributors

hayleycodes avatar jgraichen avatar johnsyweb avatar joho avatar lparry avatar mariovisic avatar notahat avatar orien avatar pithyless avatar rabidcarrot avatar stevehodgkiss avatar viraptor avatar warrenseen 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

Watchers

 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  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

exiv2's Issues

Broken after exiv2-0.28 update

FYI: Exiv2 0.28 has been released and is now the standard on archlinux, breaking this this package

I've removed my dependency on this package for now.

Exiv2::Value subtypes support

It should be possible to read and write Value using subtypes, especially XmpValue and its subtypes.
Or at least provide access for value_ fields (http://www.exiv2.org/doc/classExiv2_1_1XmpArrayValue.html#620cf5acd40bea72c7b3cdb3894fea6a, http://www.exiv2.org/doc/classExiv2_1_1LangAltValue.html#e466310e854d707c1e5f5a44730a27c9 and others).

If you don't want to break current interface my idea is to add singleton method to the string object that represents Exiv2::Value that will return value_ field if available.

Xmp.dc.subject is not saved as Array type

According to the exiv2 documentation, the Xmp.dc.subject field seems to be the "new" place to store keywords (apart from Iptc.Application2.Keywords)

Unfortunately, if multiple values get assigned to that field like so

image.xmp_data.add("Xmp.dc.subject", "kw1")
image.xmp_data.add("Xmp.dc.subject", "kw2")
image.write_metadata

only the value assigned last makes it into the actual file headers, the rest is lost.

Failed to install on OSX Yosemite Beta 3

Logged:

/opt/boxen/rbenv/versions/2.1.3/bin/ruby extconf.rb
checking for main() in -lexiv2... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling exiv2.cpp
exiv2.cpp:1:10: fatal error: 'exiv2/image.hpp' file not found
#include "exiv2/image.hpp"
         ^
1 error generated.
make: *** [exiv2.o] Error 1

make failed, exit code 2

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.