cul_image_props 0.2.0 → 0.2.1
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.
@@ -110,6 +110,7 @@ end
|
|
110
110
|
|
111
111
|
# class that handles an EXIF header
|
112
112
|
class EXIF_header
|
113
|
+
X00 = [0x00].pack('C')
|
113
114
|
attr_accessor :tags
|
114
115
|
def initialize(file, endian, offset, fake_exif, strict, detail=true)
|
115
116
|
@file = file
|
@@ -158,7 +159,7 @@ class EXIF_header
|
|
158
159
|
end
|
159
160
|
# Sign extension ?
|
160
161
|
if signed
|
161
|
-
msb= 1 << (8*length-1)
|
162
|
+
msb= 1 << (8*src.length-1)
|
162
163
|
if val & msb
|
163
164
|
val=val-(msb << 1)
|
164
165
|
end
|
@@ -178,19 +179,7 @@ class EXIF_header
|
|
178
179
|
return 0
|
179
180
|
end
|
180
181
|
slice=@file.read(length)
|
181
|
-
|
182
|
-
val=s2n_intel(slice)
|
183
|
-
else
|
184
|
-
val=s2n_motorola(slice)
|
185
|
-
end
|
186
|
-
# Sign extension ?
|
187
|
-
if signed
|
188
|
-
msb= 1 << (8*length-1)
|
189
|
-
if val & msb
|
190
|
-
val=val-(msb << 1)
|
191
|
-
end
|
192
|
-
end
|
193
|
-
return val
|
182
|
+
return unpack_number(slice,signed)
|
194
183
|
end
|
195
184
|
|
196
185
|
# convert offset to string
|
@@ -298,7 +287,7 @@ class EXIF_header
|
|
298
287
|
values = @file.read(count)
|
299
288
|
#print values
|
300
289
|
# Drop any garbage after a null.
|
301
|
-
values = values.split(
|
290
|
+
values = values.split(X00, 1)[0]
|
302
291
|
else
|
303
292
|
values = ''
|
304
293
|
end
|
@@ -326,7 +315,7 @@ class EXIF_header
|
|
326
315
|
if count == 1 and field_type != 2
|
327
316
|
printable=values[0].to_s
|
328
317
|
elsif count > 50 and values.length > 20
|
329
|
-
printable= "[" + values[0...20].join(',') + ", ... ]"
|
318
|
+
printable= (field_type == 2) ? (values[0...20] + '...') : ("[" + values[0...20].join(',') + ", ... ]")
|
330
319
|
else
|
331
320
|
printable=values.inspect
|
332
321
|
end
|
@@ -364,13 +353,13 @@ class EXIF_header
|
|
364
353
|
entries = self.s2n(thumb_ifd, 2)
|
365
354
|
# this is header plus offset to IFD ...
|
366
355
|
if @endian == 'M'
|
367
|
-
tiff =
|
356
|
+
tiff = "MM#{X00}*" + [0x00,0x00,0x00,0x00,0x08].pack('C*')
|
368
357
|
else
|
369
|
-
tiff = 'II
|
358
|
+
tiff = 'II*' + [0x00,0x08,0x00,0x00,0x00].pack('C*')
|
370
359
|
end
|
371
360
|
# ... plus thumbnail IFD data plus a null "next IFD" pointer
|
372
361
|
self.file.seek(self.offset+thumb_ifd)
|
373
|
-
tiff += self.file.read(entries*12+2)+'
|
362
|
+
tiff += self.file.read(entries*12+2)+[0x00,0x00,0x00,0x00].pack('C*')
|
374
363
|
|
375
364
|
# fix up large value offset pointers into data area
|
376
365
|
(0...entries).each { |i|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cul_image_props
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|