exif 1.0.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore DELETED
@@ -1,14 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.0
4
- - 2.1.5
5
- - 2.0.0
6
- - 1.9.3
data/Gemfile DELETED
@@ -1,2 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 Tony Jian
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md DELETED
@@ -1,226 +0,0 @@
1
- Ruby EXIF reader written in C extension. [![Build Status](https://travis-ci.org/tonytonyjan/exif.svg?branch=master)](https://travis-ci.org/tonytonyjan/exif)
2
-
3
- # Installation
4
-
5
- $ gem install exif
6
-
7
- Please make sure you have installed `libexif` first:
8
-
9
- $ brew install libexif # Homebrew
10
- $ sudo apt-get install libexif-dev # APT
11
-
12
- # Usage
13
-
14
- ```ruby
15
- data = Exif::Data.new('sample.jpg')
16
- data.model # => "NIKON D600"
17
- data.image_width # => 4000
18
- data.gps_longitude # => 121.51246
19
- data.date_time # => 2013-12-08 21:14:11 0800
20
-
21
- # get all entries in an IFD
22
- data[0] # => {image_width: 4000, image_length: 2670, ...}
23
- data[1] # => {x_resolution: "72", y_resolution: "72", ...}
24
- data[:exif] # => exposure_time: "1/125 sec.", f_number: "f/8.0"}
25
- data[:gps] # => {gps_version_id: "2.2.0.0", gps_latitude_ref: "N", ...}
26
- data[:interoperability] # => {...}
27
- data.to_h # => {0 => {...}, 1 => {...}, :exif => {...}}
28
- ```
29
-
30
- # How fast?
31
-
32
- There are some other excellent works called [exifr](https://github.com/remvee/exifr) by [@remvee](https://github.com/remvee), and [mini_exiftool](https://github.com/janfri/mini_exiftool) by [@janfri](https://github.com/janfri). They're built in pure Ruby while this one is C extension.
33
-
34
- If you program JRuby, you may want to choose exifr or mini_exiftool, the latter lets you get the full power of [Exiftool](http://www.sno.phy.queensu.ca/~phil/exiftool/) written by Phil Harvey since it's a command-line wrapper, otherwise you can try this gem for speed purpose. **It's about 8 times faster than exifr and 1200 times than that of mini_exiftool.**
35
-
36
- A small benchmark shows below:
37
-
38
- ```ruby
39
- require 'benchmark'
40
- require 'mini_exiftool'
41
- require 'exifr'
42
- require 'exif'
43
-
44
- N = 50
45
- FILE_PATH = File.expand_path('../../spec/sample.jpg', __FILE__)
46
- Benchmark.bmbm do |x|
47
- x.report 'mini_exiftool' do
48
- N.times{ MiniExiftool.new(FILE_PATH).image_width }
49
- end
50
- x.report 'exifr' do
51
- N.times{ EXIFR::JPEG.new(FILE_PATH).width }
52
- end
53
- x.report 'exif' do
54
- N.times{ Exif::Data.new(FILE_PATH).image_width }
55
- end
56
- end
57
- ```
58
-
59
- ```
60
- $ ruby benchmark/benchmark.rb
61
- Rehearsal -------------------------------------------------
62
- mini_exiftool 0.150000 0.050000 12.390000 ( 12.546417)
63
- exifr 0.090000 0.000000 0.090000 ( 0.091090)
64
- exif 0.010000 0.000000 0.010000 ( 0.010343)
65
- --------------------------------------- total: 12.490000sec
66
- user system total real
67
- mini_exiftool 0.150000 0.050000 12.400000 ( 12.540122)
68
- exifr 0.080000 0.000000 0.080000 ( 0.083251)
69
- exif 0.010000 0.000000 0.010000 ( 0.009855)
70
- ```
71
-
72
- ## Tag Rreference
73
-
74
- - aperture_value
75
- - artist
76
- - battery_level
77
- - bits_per_sample
78
- - brightness_value
79
- - cfa_pattern
80
- - cfa_repeat_pattern_dim
81
- - color_space
82
- - components_configuration
83
- - compressed_bits_per_pixel
84
- - compression
85
- - contrast
86
- - copyright
87
- - custom_rendered
88
- - date_time
89
- - date_time_digitized
90
- - date_time_original
91
- - device_setting_description
92
- - digital_zoom_ratio
93
- - document_name
94
- - exif_ifd_pointer
95
- - exif_version
96
- - exposure_bias_value
97
- - exposure_index
98
- - exposure_mode
99
- - exposure_program
100
- - exposure_time
101
- - file_source
102
- - fill_order
103
- - flash
104
- - flash_energy
105
- - flash_pix_version
106
- - fnumber
107
- - focal_length
108
- - focal_length_in_35mm_film
109
- - focal_plane_resolution_unit
110
- - focal_plane_x_resolution
111
- - focal_plane_y_resolution
112
- - gain_control
113
- - gamma
114
- - gps_altitude
115
- - gps_altitude_ref
116
- - gps_area_information
117
- - gps_date_stamp
118
- - gps_dest_bearing
119
- - gps_dest_bearing_ref
120
- - gps_dest_distance
121
- - gps_dest_distance_ref
122
- - gps_dest_latitude
123
- - gps_dest_latitude_ref
124
- - gps_dest_longitude
125
- - gps_dest_longitude_ref
126
- - gps_differential
127
- - gps_dop
128
- - gps_img_direction
129
- - gps_img_direction_ref
130
- - gps_info_ifd_pointer
131
- - gps_latitude
132
- - gps_latitude_ref
133
- - gps_longitude
134
- - gps_longitude_ref
135
- - gps_map_datum
136
- - gps_measure_mode
137
- - gps_processing_method
138
- - gps_satellites
139
- - gps_speed
140
- - gps_speed_ref
141
- - gps_status
142
- - gps_time_stamp
143
- - gps_track
144
- - gps_track_ref
145
- - gps_version_id
146
- - image_description
147
- - image_length
148
- - image_resources
149
- - image_unique_id
150
- - image_width
151
- - inter_color_profile
152
- - interoperability_ifd_pointer
153
- - interoperability_index
154
- - interoperability_version
155
- - iptc_naa
156
- - iso_speed_ratings
157
- - jpeg_interchange_format
158
- - jpeg_interchange_format_length
159
- - jpeg_proc
160
- - light_source
161
- - make
162
- - maker_note
163
- - max_aperture_value
164
- - metering_mode
165
- - model
166
- - new_cfa_pattern
167
- - new_subfile_type
168
- - oecf
169
- - orientation
170
- - padding
171
- - photometric_interpretation
172
- - pixel_x_dimension
173
- - pixel_y_dimension
174
- - planar_configuration
175
- - primary_chromaticities
176
- - print_image_matching
177
- - reference_black_white
178
- - related_image_file_format
179
- - related_image_length
180
- - related_image_width
181
- - related_sound_file
182
- - resolution_unit
183
- - rows_per_strip
184
- - samples_per_pixel
185
- - saturation
186
- - scene_capture_type
187
- - scene_type
188
- - sensing_method
189
- - sharpness
190
- - shutter_speed_value
191
- - software
192
- - spatial_frequency_response
193
- - spectral_sensitivity
194
- - strip_byte_counts
195
- - strip_offsets
196
- - sub_ifds
197
- - sub_sec_time
198
- - sub_sec_time_digitized
199
- - sub_sec_time_original
200
- - subject_area
201
- - subject_distance
202
- - subject_distance_range
203
- - subject_location
204
- - tiff_ep_standard_id
205
- - time_zone_offset
206
- - transfer_function
207
- - transfer_range
208
- - user_comment
209
- - white_balance
210
- - white_point
211
- - x_resolution
212
- - xml_packet
213
- - xp_author
214
- - xp_comment
215
- - xp_keywords
216
- - xp_subject
217
- - xp_title
218
- - y_resolution
219
- - ycbcr_coefficients
220
- - ycbcr_positioning
221
- - ycbcr_sub_sampling
222
-
223
- # TODO
224
-
225
- 1. Support reading from String.
226
- 2. Create, update and delete tags.
data/Rakefile DELETED
@@ -1,11 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/extensiontask"
3
- require 'rspec/core/rake_task'
4
-
5
- Rake::ExtensionTask.new("exif") do |ext|
6
- ext.lib_dir = "lib/exif"
7
- end
8
-
9
- RSpec::Core::RakeTask.new(:spec)
10
-
11
- task default: [:compile, :spec]
@@ -1,19 +0,0 @@
1
- $: << File.expand_path('../../lib', __FILE__)
2
- require 'benchmark'
3
- require 'mini_exiftool'
4
- require 'exifr'
5
- require 'exif'
6
-
7
- N = 50
8
- FILE_PATH = File.expand_path('../../spec/sample.jpg', __FILE__)
9
- Benchmark.bmbm do |x|
10
- x.report 'mini_exiftool' do
11
- N.times{ MiniExiftool.new(FILE_PATH).image_width }
12
- end
13
- x.report 'exifr' do
14
- N.times{ EXIFR::JPEG.new(FILE_PATH).width }
15
- end
16
- x.report 'exif' do
17
- N.times{ Exif::Data.new(FILE_PATH).image_width }
18
- end
19
- end
@@ -1,26 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'exif/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "exif"
8
- spec.version = Exif::VERSION
9
- spec.authors = ["Jian Weihang"]
10
- spec.email = ["tonytonyjan@gmail.com"]
11
- spec.extensions = ["ext/exif/extconf.rb"]
12
- spec.summary = %q{Ruby EXIF reader written in C extension.}
13
- spec.description = %q{Ruby EXIF reader written in C extension.}
14
- spec.homepage = "https://github.com/tonytonyjan/exif"
15
- spec.license = "MIT"
16
-
17
- spec.files = `git ls-files -z`.split("\x0")
18
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
- spec.require_paths = ["lib"]
21
-
22
- spec.add_development_dependency "bundler", "~> 1.7"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- spec.add_development_dependency "rake-compiler"
25
- spec.add_development_dependency "rspec"
26
- end
@@ -1,6 +0,0 @@
1
- #ifndef EXIF_H
2
- #define EXIF_H 1
3
-
4
- #include "ruby.h"
5
-
6
- #endif /* EXIF_H */
@@ -1,14 +0,0 @@
1
- require 'exif'
2
-
3
- describe Exif do
4
- before :all do
5
- @data = Exif::Data.new(File.expand_path('../sample.jpg', __FILE__))
6
- end
7
-
8
- it 'works' do
9
- expect(@data.model).to eq 'NIKON D600'
10
- expect(@data.image_width).to eq 4000
11
- expect(@data.gps_latitude).to be_within(0.0001).of(24.178028333333334)
12
- expect(@data.date_time).to eq Time.new(2013,12,8,21,14,11)
13
- end
14
- end
Binary file
@@ -1,89 +0,0 @@
1
- # This file was generated by the `rspec --init` command. Conventionally, all
2
- # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
- # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
- # file to always be loaded, without a need to explicitly require it in any files.
5
- #
6
- # Given that it is always loaded, you are encouraged to keep this file as
7
- # light-weight as possible. Requiring heavyweight dependencies from this file
8
- # will add to the boot time of your test suite on EVERY test run, even for an
9
- # individual file that may not need all of that loaded. Instead, consider making
10
- # a separate helper file that requires the additional dependencies and performs
11
- # the additional setup, and require it from the spec files that actually need it.
12
- #
13
- # The `.rspec` file also contains a few flags that are not defaults but that
14
- # users commonly want.
15
- #
16
- # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
- RSpec.configure do |config|
18
- # rspec-expectations config goes here. You can use an alternate
19
- # assertion/expectation library such as wrong or the stdlib/minitest
20
- # assertions if you prefer.
21
- config.expect_with :rspec do |expectations|
22
- # This option will default to `true` in RSpec 4. It makes the `description`
23
- # and `failure_message` of custom matchers include text for helper methods
24
- # defined using `chain`, e.g.:
25
- # be_bigger_than(2).and_smaller_than(4).description
26
- # # => "be bigger than 2 and smaller than 4"
27
- # ...rather than:
28
- # # => "be bigger than 2"
29
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
30
- end
31
-
32
- # rspec-mocks config goes here. You can use an alternate test double
33
- # library (such as bogus or mocha) by changing the `mock_with` option here.
34
- config.mock_with :rspec do |mocks|
35
- # Prevents you from mocking or stubbing a method that does not exist on
36
- # a real object. This is generally recommended, and will default to
37
- # `true` in RSpec 4.
38
- mocks.verify_partial_doubles = true
39
- end
40
-
41
- # The settings below are suggested to provide a good initial experience
42
- # with RSpec, but feel free to customize to your heart's content.
43
- =begin
44
- # These two settings work together to allow you to limit a spec run
45
- # to individual examples or groups you care about by tagging them with
46
- # `:focus` metadata. When nothing is tagged with `:focus`, all examples
47
- # get run.
48
- config.filter_run :focus
49
- config.run_all_when_everything_filtered = true
50
-
51
- # Limits the available syntax to the non-monkey patched syntax that is recommended.
52
- # For more details, see:
53
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
54
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
55
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
56
- config.disable_monkey_patching!
57
-
58
- # This setting enables warnings. It's recommended, but in some cases may
59
- # be too noisy due to issues in dependencies.
60
- config.warnings = true
61
-
62
- # Many RSpec users commonly either run the entire suite or an individual
63
- # file, and it's useful to allow more verbose output when running an
64
- # individual spec file.
65
- if config.files_to_run.one?
66
- # Use the documentation formatter for detailed output,
67
- # unless a formatter has already been configured
68
- # (e.g. via a command-line flag).
69
- config.default_formatter = 'doc'
70
- end
71
-
72
- # Print the 10 slowest examples and example groups at the
73
- # end of the spec run, to help surface which specs are running
74
- # particularly slow.
75
- config.profile_examples = 10
76
-
77
- # Run specs in random order to surface order dependencies. If you find an
78
- # order dependency and want to debug it, you can fix the order by providing
79
- # the seed, which is printed after each run.
80
- # --seed 1234
81
- config.order = :random
82
-
83
- # Seed global randomization in this process using the `--seed` CLI option.
84
- # Setting this allows you to use `--seed` to deterministically reproduce
85
- # test failures related to randomization by passing the same `--seed` value
86
- # as the one that triggered the failure.
87
- Kernel.srand config.seed
88
- =end
89
- end