exiftoolr 0.0.9 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,87 +1,89 @@
1
- ---
2
- :exposure_compensation: 0
3
- :model: DROIDX 6d460001fff80000015d7d330e01c011
4
- :color_space: sRGB
5
- :components_configuration: Cb, Y, Cr, Y
6
- :exif_byte_order: Little-endian (Intel, II)
7
- :sensing_method: One-chip color area
8
- :create_date: 2010-12-08 01:15:37 -08:00
9
- :bits_per_sample: 8
10
- :date_time_original: 2010-12-08 01:15:37 -08:00
11
- :source_file: test/Droid X.jpg
12
- :thumbnail_length: 32586
13
- :exif_image_width: 3264
14
- :scene_type: Directly photographed
15
- :contrast: Normal
16
- :exposure_program: Program AE
17
- :compression: JPEG (old-style)
18
- :image_size: 3264x1840
19
- :max_aperture_value: 2.8
1
+ ---
2
+ :source_file: /Users/mrm/Dropbox/code/exiftoolr/test/Droid X.jpg
3
+ :exif_tool_version: 9.31
4
+ :file_name: Droid X.jpg
5
+ :directory: /Users/mrm/Dropbox/code/exiftoolr/test
6
+ :file_size: 2023 kB
7
+ :file_modify_date: 2012-02-23 05:22:17.000000000 +00:00
8
+ :file_access_date: 2013-07-14 20:25:41.000000000 +00:00
9
+ :file_inode_change_date: 2013-02-16 19:21:58.000000000 +00:00
10
+ :file_permissions: rwxr-xr-x
11
+ :file_type: JPEG
20
12
  :mime_type: image/jpeg
21
- :x_resolution: 300
22
- :interop_version: "0100"
13
+ :exif_byte_order: Little-endian (Intel, II)
14
+ :make: Motorola
15
+ :model: DROIDX 6d460001fff80000015d7d330e01c011
23
16
  :orientation: Rotate 90 CW
17
+ :x_resolution: 300
18
+ :y_resolution: 300
19
+ :resolution_unit: inches
24
20
  :software: 2.2
25
- :thumbnail_offset: 2150
26
- :shutter_speed: !ruby/object:Rational
21
+ :modify_date: 2010-12-08 01:15:37.000000000 +00:00
22
+ :y_cb_cr_positioning: Centered
23
+ :exposure_time: !ruby/object:Rational
27
24
  denominator: 15
28
25
  numerator: 1
29
- :directory: test
30
- :flashpix_version: "0100"
31
- :y_cb_cr_positioning: Centered
32
- :flash: Auto, Did not fire
33
26
  :f_number: 2.8
34
- :saturation: Normal
35
- :file_modify_date: 2012-02-19 21:49:48 -08:00
36
- :y_resolution: 300
37
- :encoding_process: Baseline DCT, Huffman coding
38
- :subject_distance: 0 m
39
- :thumbnail_image: (Binary data 32586 bytes)
40
- :white_balance: Auto
41
- :metering_mode: Center-weighted average
42
- :exposure_mode: Auto
27
+ :exposure_program: Program AE
28
+ :iso: 637
29
+ :exif_version: '0220'
30
+ :date_time_original: 2010-12-08 01:15:37.000000000 +00:00
31
+ :create_date: 2010-12-08 01:15:37.000000000 +00:00
32
+ :components_configuration: Cb, Y, Cr, Y
43
33
  :compressed_bits_per_pixel: 4
44
- :circle_of_confusion: 0.004 mm
45
- :color_components: 3
46
- :image_height: 1840
47
- :exif_tool_version: 8.59
48
- :subject_distance_range: Unknown
49
- :exposure_time: !ruby/object:Rational
34
+ :shutter_speed_value: !ruby/object:Rational
50
35
  denominator: 15
51
36
  numerator: 1
52
- :resolution_unit: inches
53
- :scene_capture_type: Standard
54
- :file_name: Droid X.jpg
55
- :image_unique_id: ""
56
- :hyperfocal_distance: 2.24 m
57
- :focal_length35efl: "5.0 mm (35 mm equivalent: 38.0 mm)"
58
- :light_source: Standard Light A
59
- :y_cb_cr_sub_sampling: YCbCr4:2:0 (2 2)
60
- :aperture: 2.8
61
- :interop_index: R98 - DCF basic file (sRGB)
62
- :fov: 50.7 deg
63
- :brightness_value: -0.8203125
64
- :file_permissions: rwxr-xr-x
65
- :exif_version: "0220"
66
- :digital_zoom_ratio: 0
67
- :sharpness: Normal
68
- :custom_rendered: Custom
69
37
  :aperture_value: 2.8
70
- :exif_image_height: 1840
38
+ :brightness_value: -0.8203125
39
+ :exposure_compensation: 0
40
+ :max_aperture_value: 2.8
41
+ :subject_distance: 0 m
42
+ :metering_mode: Center-weighted average
43
+ :light_source: Standard Light A
44
+ :flash: Auto, Did not fire
71
45
  :focal_length: 5.0 mm
72
- :gain_control: High gain up
73
- :light_value: 4.2
74
- :modify_date: 2010-12-08 01:15:37 -08:00
75
- :shutter_speed_value: !ruby/object:Rational
76
- denominator: 15
77
- numerator: 1
78
- :make: Motorola
46
+ :user_comment: ''
47
+ :flashpix_version: '0100'
48
+ :color_space: sRGB
49
+ :exif_image_width: 3264
50
+ :exif_image_height: 1840
51
+ :interop_index: R98 - DCF basic file (sRGB)
52
+ :interop_version: '0100'
79
53
  :exposure_index: 637
80
- :file_size: 2023 kB
54
+ :sensing_method: One-chip color area
55
+ :file_source: Digital Camera
56
+ :scene_type: Directly photographed
57
+ :custom_rendered: Custom
58
+ :exposure_mode: Auto
59
+ :white_balance: Auto
60
+ :digital_zoom_ratio: 0
81
61
  :focal_length_in35mm_format: 38 mm
62
+ :scene_capture_type: Standard
63
+ :gain_control: High gain up
64
+ :contrast: Normal
65
+ :saturation: Normal
66
+ :sharpness: Normal
67
+ :subject_distance_range: Unknown
68
+ :image_unique_id: ''
69
+ :compression: JPEG (old-style)
70
+ :thumbnail_offset: 2150
71
+ :thumbnail_length: 32586
82
72
  :image_width: 3264
83
- :user_comment: ""
84
- :file_type: JPEG
73
+ :image_height: 1840
74
+ :encoding_process: Baseline DCT, Huffman coding
75
+ :bits_per_sample: 8
76
+ :color_components: 3
77
+ :y_cb_cr_sub_sampling: YCbCr4:2:0 (2 2)
78
+ :aperture: 2.8
79
+ :image_size: 3264x1840
85
80
  :scale_factor35efl: 7.6
86
- :iso: 637
87
- :file_source: Digital Camera
81
+ :shutter_speed: !ruby/object:Rational
82
+ denominator: 15
83
+ numerator: 1
84
+ :thumbnail_image: (Binary data 32586 bytes)
85
+ :circle_of_confusion: 0.004 mm
86
+ :fov: 50.7 deg
87
+ :focal_length35efl: '5.0 mm (35 mm equivalent: 38.0 mm)'
88
+ :hyperfocal_distance: 2.24 m
89
+ :light_value: 4.2
Binary file
@@ -0,0 +1,211 @@
1
+ ---
2
+ :source_file: /Users/mrm/Dropbox/code/exiftoolr/test/IMG_2452.jpg
3
+ :exif_tool_version: 9.31
4
+ :file_name: IMG_2452.jpg
5
+ :directory: /Users/mrm/Dropbox/code/exiftoolr/test
6
+ :file_size: 2.8 MB
7
+ :file_modify_date: 2013-07-14 17:51:04.000000000 +00:00
8
+ :file_access_date: 2013-07-14 20:25:41.000000000 +00:00
9
+ :file_inode_change_date: 2013-07-14 17:51:04.000000000 +00:00
10
+ :file_permissions: rw-r--r--
11
+ :file_type: JPEG
12
+ :mime_type: image/jpeg
13
+ :exif_byte_order: Big-endian (Motorola, MM)
14
+ :image_description: ' '
15
+ :make: Canon
16
+ :model: Canon PowerShot SD980 IS
17
+ :orientation: Horizontal (normal)
18
+ :x_resolution: 72
19
+ :y_resolution: 72
20
+ :resolution_unit: inches
21
+ :software: QuickTime 7.6.6
22
+ :modify_date: 2011-07-06 20:41:11.000000000 +00:00
23
+ :host_computer: Mac OS X 10.6.8
24
+ :y_cb_cr_positioning: Co-sited
25
+ :exposure_time: !ruby/object:Rational
26
+ denominator: 800
27
+ numerator: 1
28
+ :f_number: 2.8
29
+ :iso: 160
30
+ :exif_version: '0220'
31
+ :date_time_original: 2011-07-06 09:46:45.000000000 +00:00
32
+ :create_date: 2011-07-06 09:46:45.000000000 +00:00
33
+ :components_configuration: Y, Cb, Cr, -
34
+ :compressed_bits_per_pixel: 3
35
+ :shutter_speed_value: !ruby/object:Rational
36
+ denominator: 807
37
+ numerator: 1
38
+ :aperture_value: 2.8
39
+ :max_aperture_value: 2.8
40
+ :flash: Auto, Did not fire
41
+ :focal_length: 4.3 mm
42
+ :warning: '[minor] Adjusted MakerNotes base by 50'
43
+ :macro_mode: Normal
44
+ :self_timer: 'Off'
45
+ :quality: Fine
46
+ :canon_flash_mode: Red-eye reduction (Auto)
47
+ :continuous_drive: Single
48
+ :focus_mode: Single
49
+ :record_mode: JPEG
50
+ :canon_image_size: Widescreen
51
+ :easy_mode: Full auto
52
+ :digital_zoom: None
53
+ :contrast: Normal
54
+ :saturation: Normal
55
+ :sharpness: 0
56
+ :camera_iso: Auto
57
+ :metering_mode: Evaluative
58
+ :focus_range: Auto
59
+ :af_point: Face Detect
60
+ :canon_exposure_mode: Easy
61
+ :lens_type: Unknown (-1)
62
+ :max_focal_length: 21.5 mm
63
+ :min_focal_length: 4.3 mm
64
+ :focal_units: 1000/mm
65
+ :max_aperture: 2.8
66
+ :min_aperture: 8
67
+ :flash_bits: (none)
68
+ :focus_continuous: Continuous
69
+ :ae_setting: Normal AE
70
+ :image_stabilization: 'On'
71
+ :zoom_source_width: 4000
72
+ :zoom_target_width: 4000
73
+ :spot_metering_mode: Center
74
+ :manual_flash_output: n/a
75
+ :focal_type: Zoom
76
+ :focal_plane_x_size: 6.35 mm
77
+ :focal_plane_y_size: 3.56 mm
78
+ :auto_iso: 148
79
+ :base_iso: 100
80
+ :measured_ev: 13.25
81
+ :target_aperture: 2.8
82
+ :target_exposure_time: !ruby/object:Rational
83
+ denominator: 807
84
+ numerator: 1
85
+ :exposure_compensation: 0
86
+ :white_balance: Auto
87
+ :slow_shutter: 'Off'
88
+ :sequence_number: 0
89
+ :optical_zoom_code: 0
90
+ :flash_guide_number: 0
91
+ :flash_exposure_comp: 0
92
+ :auto_exposure_bracketing: 'Off'
93
+ :aeb_bracket_value: 0
94
+ :control_mode: Camera Local Control
95
+ :focus_distance_upper: 65.53 m
96
+ :focus_distance_lower: 0 m
97
+ :bulb_duration: 0
98
+ :camera_type: Compact
99
+ :auto_rotate: Rotate 270 CW
100
+ :nd_filter: 'Off'
101
+ :self_timer2: 0
102
+ :flash_output: 0
103
+ :canon_image_type: IMG:PowerShot SD980 IS JPEG
104
+ :canon_firmware_version: Firmware Version 1.01
105
+ :file_number: 132-2452
106
+ :owner_name: ''
107
+ :rotation: 270
108
+ :camera_temperature: 29 C
109
+ :canon_model_id: PowerShot SD980 IS / Digital IXUS 200 IS / IXY Digital 930 IS
110
+ :af_area_mode: Multi-point AF or AI AF
111
+ :num_af_points: 9
112
+ :valid_af_points: 9
113
+ :canon_image_width: 4000
114
+ :canon_image_height: 2248
115
+ :af_image_width: 1000
116
+ :af_image_height: 100
117
+ :af_area_widths: 135 135 135 135 135 135 135 135 135
118
+ :af_area_heights: 18 18 18 18 18 18 18 18 18
119
+ :af_area_x_positions: -135 0 135 -135 0 135 -135 0 135
120
+ :af_area_y_positions: -18 -18 -18 0 0 0 18 18 18
121
+ :af_points_in_focus: 4
122
+ :primary_af_point: 4
123
+ :thumbnail_image_valid_area: 0 159 15 104
124
+ :date_stamp_mode: 'Off'
125
+ :my_color_mode: 'Off'
126
+ :firmware_revision: 1.01 rev 3.00
127
+ :categories: (none)
128
+ :intelligent_contrast: 'Off'
129
+ :image_unique_id: a3154f6d7ed923fe22415586cb3f8922
130
+ :vrd_offset: 0
131
+ :user_comment: ''
132
+ :flashpix_version: '0100'
133
+ :color_space: sRGB
134
+ :exif_image_width: 4000
135
+ :exif_image_height: 2248
136
+ :focal_plane_x_resolution: 16393.44262
137
+ :focal_plane_y_resolution: 12284.15301
138
+ :focal_plane_resolution_unit: inches
139
+ :sensing_method: One-chip color area
140
+ :file_source: Digital Camera
141
+ :custom_rendered: Normal
142
+ :exposure_mode: Auto
143
+ :digital_zoom_ratio: 1
144
+ :scene_capture_type: Standard
145
+ :compression: JPEG (old-style)
146
+ :thumbnail_offset: 3480
147
+ :thumbnail_length: 4627
148
+ :comment: |
149
+ AppleMark
150
+ :image_width: 2248
151
+ :image_height: 4000
152
+ :encoding_process: Baseline DCT, Huffman coding
153
+ :bits_per_sample: 8
154
+ :color_components: 3
155
+ :y_cb_cr_sub_sampling: YCbCr4:2:2 (2 1)
156
+ :profile_cmm_type: Lino
157
+ :profile_version: 2.1.0
158
+ :profile_class: Display Device Profile
159
+ :color_space_data: 'RGB '
160
+ :profile_connection_space: 'XYZ '
161
+ :profile_date_time: 1998-02-09 06:49:00.000000000 +00:00
162
+ :profile_file_signature: acsp
163
+ :primary_platform: Microsoft Corporation
164
+ :cmm_flags: Not Embedded, Independent
165
+ :device_manufacturer: 'IEC '
166
+ :device_model: sRGB
167
+ :device_attributes: Reflective, Glossy, Positive, Color
168
+ :rendering_intent: Perceptual
169
+ :connection_space_illuminant: 0.9642 1 0.82491
170
+ :profile_creator: 'HP '
171
+ :profile_id: 0
172
+ :profile_copyright: Copyright (c) 1998 Hewlett-Packard Company
173
+ :profile_description: sRGB IEC61966-2.1
174
+ :media_white_point: 0.95045 1 1.08905
175
+ :media_black_point: 0 0 0
176
+ :red_matrix_column: 0.43607 0.22249 0.01392
177
+ :green_matrix_column: 0.38515 0.71687 0.09708
178
+ :blue_matrix_column: 0.14307 0.06061 0.7141
179
+ :device_mfg_desc: IEC http://www.iec.ch
180
+ :device_model_desc: IEC 61966-2.1 Default RGB colour space - sRGB
181
+ :viewing_cond_desc: Reference Viewing Condition in IEC61966-2.1
182
+ :viewing_cond_illuminant: 19.6445 20.3718 16.8089
183
+ :viewing_cond_surround: 3.92889 4.07439 3.36179
184
+ :viewing_cond_illuminant_type: D50
185
+ :luminance: 76.03647 80 87.12462
186
+ :measurement_observer: CIE 1931
187
+ :measurement_backing: 0 0 0
188
+ :measurement_geometry: Unknown (0)
189
+ :measurement_flare: 0.999%
190
+ :measurement_illuminant: D65
191
+ :technology: Cathode Ray Tube Display
192
+ :red_trc: (Binary data 2060 bytes)
193
+ :green_trc: (Binary data 2060 bytes)
194
+ :blue_trc: (Binary data 2060 bytes)
195
+ :aperture: 2.8
196
+ :drive_mode: Single-frame Shooting
197
+ :image_size: 2248x4000
198
+ :lens: 4.3 - 21.5 mm
199
+ :lens_id: Unknown 4-21mm
200
+ :scale_factor35efl: 5.6
201
+ :shooting_mode: Full auto
202
+ :shutter_speed: !ruby/object:Rational
203
+ denominator: 800
204
+ numerator: 1
205
+ :thumbnail_image: (Binary data 4627 bytes)
206
+ :circle_of_confusion: 0.005 mm
207
+ :fov: 73.7 deg
208
+ :focal_length35efl: '4.3 mm (35 mm equivalent: 24.0 mm)'
209
+ :hyperfocal_distance: 1.23 m
210
+ :lens35efl: '4.3 - 21.5 mm (35 mm equivalent: 24.0 - 120.1 mm)'
211
+ :light_value: 11.9
@@ -0,0 +1,87 @@
1
+ require 'test_helper'
2
+
3
+ describe Exiftoolr do
4
+
5
+ DUMP_RESULTS = false
6
+
7
+ it 'raises NoSuchFile for missing files' do
8
+ proc { Exiftoolr.new('no/such/file') }.must_raise Exiftoolr::NoSuchFile
9
+ end
10
+
11
+ it 'raises NotAFile for directories' do
12
+ proc { Exiftoolr.new('lib') }.must_raise Exiftoolr::NotAFile
13
+ end
14
+
15
+ it 'no-ops with no files' do
16
+ e = Exiftoolr.new([])
17
+ e.errors?.must_be_false
18
+ end
19
+
20
+ it 'has errors with files without EXIF headers' do
21
+ e = Exiftoolr.new("Gemfile")
22
+ e.errors?.must_be_true
23
+ end
24
+
25
+ describe 'single-get' do
26
+ it 'responds with known correct responses' do
27
+ Dir['test/*.jpg'].each do |filename|
28
+ e = Exiftoolr.new(filename)
29
+ validate_result(e, filename)
30
+ end
31
+ end
32
+ end
33
+
34
+ describe 'multi-get' do
35
+ def test_multi_matches
36
+ filenames = Dir['**/*.jpg'].to_a
37
+ e = Exiftoolr.new(filenames)
38
+ filenames.each { |f| validate_result(e.result_for(f), f) }
39
+ end
40
+ end
41
+
42
+ def validate_result(result, filename)
43
+ yaml_file = "#{filename}.yaml"
44
+ exif = result.to_hash
45
+ File.open(yaml_file, 'w') { |out| YAML.dump(exif, out) } if DUMP_RESULTS
46
+ e = File.open(yaml_file) { |f| YAML::load(f) }
47
+ exif.keys.each do |k|
48
+ next if ignorable_key?(k)
49
+ expected = e[k]
50
+ next if expected.nil? # older version of exiftool
51
+ actual = exif[k]
52
+ if expected.is_a?(String)
53
+ expected.downcase!
54
+ actual.downcase!
55
+ end
56
+ puts "Key '#{k}' was incorrect for #{filename}" if expected != actual
57
+ end
58
+ end
59
+
60
+ # These are expected to be different on travis, due to different paths, filesystems, or
61
+ # exiftool version differences.
62
+ # fov and hyperfocal_distance, for example, are different between v8 and v9.
63
+ IGNORABLE_KEYS = [
64
+ :circle_of_confusion,
65
+ :create_date,
66
+ :date_time_original,
67
+ :directory,
68
+ :exif_tool_version,
69
+ :file_access_date,
70
+ :file_modify_date,
71
+ :file_permissions,
72
+ :fov,
73
+ :hyperfocal_distance,
74
+ :modify_date,
75
+ :nd_filter,
76
+ :source_file
77
+ ]
78
+
79
+ IGNORABLE_PATTERNS = [
80
+ /.*\-ml-\w\w-\w\w$/, # < translatable
81
+ /35efl$/ # < 35mm Effective focal length, whose calculation was changed between v8 and v9.
82
+ ]
83
+
84
+ def ignorable_key?(key)
85
+ IGNORABLE_KEYS.include?(key) || IGNORABLE_PATTERNS.any? { |ea| key.to_s =~ ea }
86
+ end
87
+ end