cul_image_props 0.3.4 → 0.3.5
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.
- checksums.yaml +15 -0
- data/lib/cul_image_props/image/properties/exif/constants.rb +4 -4
- data/lib/cul_image_props/image/properties/exif/types.rb +9 -3
- data/lib/cul_image_props/image/properties/exif.rb +4 -2
- data/lib/cul_image_props/image/properties/types.rb +4 -0
- data/lib/cul_image_props/image/properties/version.rb +1 -1
- data/lib/cul_image_props.rb +35 -1
- metadata +5 -15
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTk4NWQ0ZWUxNjkzMDc3NzIzMWQ4MDE3OTUwOGQzZDI1MmZkOWVlMQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NzZjZWU2YTlkZDNmYTI1MzI1OTRiMzk4NWE4YmZjOWViNmFjNjFkNQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NjVmODFiYWVlZDJjZGViMjgzNGFmM2JmOGM0OGExMDJhZTEyMDRhMTRlMjI2
|
10
|
+
OTFiODg4OGJlNzVhYjZjNWQ1MGE1MzMwMjY2ZDMyNWJiYjBjNjJjYzc3Nzcz
|
11
|
+
NjQzZDc1YjcwNzQwNDc5MGUzZTBhMDhhNmNiODYzMWE2YTA3NTM=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MWI3ZWU1MTBkNWM1YWY2N2Q2NjAyY2IxMThjYjQwZTAxYzdjZjY4ZDczODMy
|
14
|
+
MzE4NGViNjE5MmFmYjFmZjI1NTY3OGM1YWU4YzBiZmNjZWE4YzE1OGY4OTRl
|
15
|
+
MjJlODRlMzZkMDcwYmM1ZGUwZmY3OTA4NDJkMTgxYmYxYzQ4Nzk=
|
@@ -133,11 +133,11 @@ FIELD_TYPES = [
|
|
133
133
|
FieldType.new(2, 'S', 'Short'),
|
134
134
|
FieldType.new(4, 'L', 'Long'),
|
135
135
|
FieldType.new(8, 'R', 'Ratio'),
|
136
|
-
FieldType.new(1, 'SB', 'Signed Byte'),
|
136
|
+
FieldType.new(1, 'SB', 'Signed Byte', true),
|
137
137
|
FieldType.new(1, 'U', 'Undefined'),
|
138
|
-
FieldType.new(2, 'SS', 'Signed Short'),
|
139
|
-
FieldType.new(4, 'SL', 'Signed Long'),
|
140
|
-
FieldType.new(8, 'SR', 'Signed Ratio')
|
138
|
+
FieldType.new(2, 'SS', 'Signed Short', true),
|
139
|
+
FieldType.new(4, 'SL', 'Signed Long', true),
|
140
|
+
FieldType.new(8, 'SR', 'Signed Ratio', true)
|
141
141
|
]
|
142
142
|
|
143
143
|
# dictionary of main EXIF tag names
|
@@ -4,11 +4,12 @@ module Properties
|
|
4
4
|
module Exif
|
5
5
|
|
6
6
|
class FieldType
|
7
|
-
attr_accessor :length, :abbreviation, :name
|
8
|
-
def initialize(length, abb, name)
|
7
|
+
attr_accessor :length, :abbreviation, :name, :signed
|
8
|
+
def initialize(length, abb, name, signed=false)
|
9
9
|
@length = length
|
10
10
|
@abbreviation = abb
|
11
11
|
@name = name
|
12
|
+
@signed = signed
|
12
13
|
end
|
13
14
|
def [](index)
|
14
15
|
case index
|
@@ -148,6 +149,7 @@ end
|
|
148
149
|
class EXIF_header
|
149
150
|
X00 = [0x00].pack('C')
|
150
151
|
attr_accessor :tags
|
152
|
+
attr_reader :endian, :offset
|
151
153
|
def initialize(file, endian, offset, fake_exif, strict, detail=true)
|
152
154
|
@file = file
|
153
155
|
@endian = endian
|
@@ -293,6 +295,7 @@ class EXIF_header
|
|
293
295
|
end
|
294
296
|
end
|
295
297
|
typelen = FIELD_TYPES[field_type].length
|
298
|
+
signed = FIELD_TYPES[field_type].signed
|
296
299
|
count = unpack_number(@file.read(4))
|
297
300
|
|
298
301
|
# If the value exceeds 4 bytes, it is a pointer to values.
|
@@ -324,7 +327,6 @@ class EXIF_header
|
|
324
327
|
end
|
325
328
|
else
|
326
329
|
values = []
|
327
|
-
signed = [6, 8, 9, 10].include? field_type
|
328
330
|
|
329
331
|
# @todo investigate
|
330
332
|
# some entries get too big to handle could be malformed file
|
@@ -342,6 +344,10 @@ class EXIF_header
|
|
342
344
|
}
|
343
345
|
end
|
344
346
|
end
|
347
|
+
if (tag_id == 0x8769)
|
348
|
+
puts "tag_id #{tag_id} field_type #{field_type} count #{count} values #{values.inspect}"
|
349
|
+
|
350
|
+
end
|
345
351
|
|
346
352
|
self.tags[ifd_name + ' ' + tag_entry.name] = IFD_Tag.new(tag_id,
|
347
353
|
field_type, tag_entry,
|
@@ -150,18 +150,20 @@ def self.process_file(f, opts={})
|
|
150
150
|
hdr.dump_IFD(i, ifd_name, {:dict=>EXIF_TAGS, :relative=>false, :stop_tag=>stop_tag})
|
151
151
|
# EXIF IFD
|
152
152
|
exif_off = hdr.tags[ifd_name +' ExifOffset']
|
153
|
-
if exif_off
|
153
|
+
if exif_off and exif_off.values[0] < f.size
|
154
154
|
hdr.dump_IFD(exif_off.values[0], 'EXIF', {:dict=>EXIF_TAGS, :relative=>false, :stop_tag =>stop_tag})
|
155
155
|
# Interoperability IFD contained in EXIF IFD
|
156
156
|
intr_off = hdr.tags['EXIF SubIFD InteroperabilityOffset']
|
157
157
|
if intr_off
|
158
|
+
puts "INTEROP OFFSET"
|
158
159
|
hdr.dump_IFD(intr_off.values[0], 'EXIF Interoperability',
|
159
160
|
:dict=>INTR_TAGS, :relative=>false, :stop_tag =>stop_tag)
|
160
161
|
end
|
161
162
|
end
|
162
163
|
# GPS IFD
|
163
164
|
gps_off = hdr.tags[ifd_name+' GPSInfo']
|
164
|
-
if gps_off
|
165
|
+
if gps_off and gps_off.values[0] < f.size
|
166
|
+
puts "GPSINFO"
|
165
167
|
hdr.dump_IFD(gps_off.values[0], 'GPS', {:dict=>GPS_TAGS, :relative=>false, :stop_tag =>stop_tag})
|
166
168
|
end
|
167
169
|
ctr += 1
|
data/lib/cul_image_props.rb
CHANGED
@@ -1,3 +1,37 @@
|
|
1
|
+
# This library was originally adapted from exif-py, a python library
|
2
|
+
# created by Gene Cash.
|
3
|
+
# Copyright (c) 2002-2007 Gene Cash
|
4
|
+
# Copyright (c) 2007-2013 Columbia University Libraries
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
|
+
# modification, are permitted provided that the following conditions
|
8
|
+
# are met:
|
9
|
+
#
|
10
|
+
# 1. Redistributions of source code must retain the above copyright
|
11
|
+
# notice, this list of conditions and the following disclaimer.
|
12
|
+
#
|
13
|
+
# 2. Redistributions in binary form must reproduce the above
|
14
|
+
# copyright notice, this list of conditions and the following
|
15
|
+
# disclaimer in the documentation and/or other materials provided
|
16
|
+
# with the distribution.
|
17
|
+
#
|
18
|
+
# 3. Neither the name of the authors nor the names of its contributors
|
19
|
+
# may be used to endorse or promote products derived from this
|
20
|
+
# software without specific prior written permission.
|
21
|
+
#
|
22
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
23
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
24
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
25
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
26
|
+
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
27
|
+
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
28
|
+
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
29
|
+
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
30
|
+
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
31
|
+
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
32
|
+
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
#
|
34
|
+
|
1
35
|
require 'cul_image_props/image/properties/version'
|
2
36
|
require 'cul_image_props/image'
|
3
37
|
module Cul
|
@@ -8,4 +42,4 @@ module Properties
|
|
8
42
|
end
|
9
43
|
end
|
10
44
|
end
|
11
|
-
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cul_image_props
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.5
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Benjamin Armintor
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-08-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: nokogiri
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ! '>='
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ! '>='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ! '>='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,7 +41,6 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
45
|
- - ! '>='
|
52
46
|
- !ruby/object:Gem::Version
|
@@ -54,7 +48,6 @@ dependencies:
|
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
52
|
- - ! '>='
|
60
53
|
- !ruby/object:Gem::Version
|
@@ -62,7 +55,6 @@ dependencies:
|
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: mocha
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
59
|
- - ! '>='
|
68
60
|
- !ruby/object:Gem::Version
|
@@ -70,7 +62,6 @@ dependencies:
|
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
66
|
- - ! '>='
|
76
67
|
- !ruby/object:Gem::Version
|
@@ -92,26 +83,25 @@ files:
|
|
92
83
|
- lib/cul_image_props.rb
|
93
84
|
homepage:
|
94
85
|
licenses: []
|
86
|
+
metadata: {}
|
95
87
|
post_install_message:
|
96
88
|
rdoc_options: []
|
97
89
|
require_paths:
|
98
90
|
- lib
|
99
91
|
required_ruby_version: !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
92
|
requirements:
|
102
93
|
- - ! '>='
|
103
94
|
- !ruby/object:Gem::Version
|
104
95
|
version: 1.9.3
|
105
96
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
97
|
requirements:
|
108
98
|
- - ! '>='
|
109
99
|
- !ruby/object:Gem::Version
|
110
100
|
version: '0'
|
111
101
|
requirements: []
|
112
102
|
rubyforge_project:
|
113
|
-
rubygems_version:
|
103
|
+
rubygems_version: 2.0.3
|
114
104
|
signing_key:
|
115
|
-
specification_version:
|
105
|
+
specification_version: 4
|
116
106
|
summary: Library for extracting basic image properties
|
117
107
|
test_files: []
|