exifr 1.2.6 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9dc9aa8ca96c37f0d49fc68580132e0be08dd2ea
4
- data.tar.gz: 21b6bc149591d16f5ed2388d375ff66827b4de7f
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OWI5ZThmNGM1M2E2NDBhNzgyMzBmMDY0NWRlMzg0YjI5YWZkZjU2MA==
5
+ data.tar.gz: !binary |-
6
+ OTNiZmFhMTdmZTdhZjc5MThlYzFjZGNlNTZmZmI0Njc5ZTdhNjEwMw==
5
7
  SHA512:
6
- metadata.gz: 5b23487cd273bac7a76ef89db722b25910e89a16ca0fafea6545c4d5202a036cdc6a6c7fae6ef16b5d8cb8ad50113235744b5f5f3147000d42702be240d1eb2c
7
- data.tar.gz: 3a868dbb615345422bcc11e79277fdad1d62a77fb7ddcee06ab80dcf0749b76a306746abe0dab031e561413e65c06fc533e6cf275e68a340c7f097171731ed91
8
+ metadata.gz: !binary |-
9
+ NzlmOTQxYzE5M2YyYjVlNDQ4YTgyYWIxZjdjY2IyYTYwODg5NDU0YTUzMTVj
10
+ YWViYzI4YWE0ZDBmYTRjMmI0MzIwMTgwNGRjYjVkNDdmNjNmNWNhN2ZlZWUx
11
+ ZWEzYzU2MzY0ZjkyMjJjZTJmZjNiZDhjMzUwY2ZjNTg5ZTJkMTg=
12
+ data.tar.gz: !binary |-
13
+ ZDNiMDhhZWUxODU3M2U3NTExZTUzMTYxM2FhZjkzNTk5NmM2MmM1MGFkYjAw
14
+ YmE0MTI2MGI5NTdlZWFlZTI4MjJjY2IzZTMyMGNlZGVmZDlhMWVkODhjZDk2
15
+ YWJjNGZmZDM1ZjdlZWUzOWIxYzRkODdjMzcyOTdhNGY2OGQ4Mjk=
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ EXIF Reader 1.3.0
2
+ * workaround warnings when using the ruby "-w" option
3
+ * NOTE: requiring only 'exifr' will nolonger provide EXIFR::JPEG or EXIFR::TIFF, require 'exifr/jpeg' or 'exifr/tiff' instead
4
+
1
5
  EXIF Reader 1.2.6
2
6
  * bug fix; "[GH#48] handle empty file as malformed jpeg"; thanks Hoàng Xuân Phú
3
7
 
@@ -1,7 +1,11 @@
1
1
  = EXIF Reader
2
+ {<img src="https://badge.fury.io/rb/exifr.svg" alt="Gem Version" />}[https://badge.fury.io/rb/exifr]
3
+ {<img src="https://circleci.com/gh/remvee/exifr/tree/master.svg?style=shield&circle-token=7d957be2d7195f5d07a7c1962926ee626b050c2e" alt="Circle CI" />}[https://circleci.com/gh/remvee/exifr]
4
+
2
5
  EXIF Reader is a module to read metadata from JPEG and TIFF images.
3
6
 
4
7
  == Examples
8
+ require 'exifr/jpeg'
5
9
  EXIFR::JPEG.new('IMG_6841.JPG').width # => 2272
6
10
  EXIFR::JPEG.new('IMG_6841.JPG').height # => 1704
7
11
  EXIFR::JPEG.new('IMG_6841.JPG').exif? # => true
@@ -9,7 +13,10 @@ EXIF Reader is a module to read metadata from JPEG and TIFF images.
9
13
  EXIFR::JPEG.new('IMG_6841.JPG').date_time # => Fri Feb 09 16:48:54 +0100 2007
10
14
  EXIFR::JPEG.new('IMG_6841.JPG').exposure_time.to_s # => "1/15"
11
15
  EXIFR::JPEG.new('IMG_6841.JPG').f_number.to_f # => 2.0
16
+ EXIFR::JPEG.new('enkhuizen.jpg').gps.latitude # => 52.7197888888889
17
+ EXIFR::JPEG.new('enkhuizen.jpg').gps.longitude # => 5.28397777777778
12
18
 
19
+ require 'exifr/tiff'
13
20
  EXIFR::TIFF.new('DSC_0218.TIF').width # => 3008
14
21
  EXIFR::TIFF.new('DSC_0218.TIF')[1].width # => 160
15
22
  EXIFR::TIFF.new('DSC_0218.TIF').model # => "NIKON D1X"
@@ -17,9 +24,6 @@ EXIF Reader is a module to read metadata from JPEG and TIFF images.
17
24
  EXIFR::TIFF.new('DSC_0218.TIF').exposure_time.to_s # => "1/100"
18
25
  EXIFR::TIFF.new('DSC_0218.TIF').f_number.to_f # => 5.0
19
26
 
20
- EXIFR::JPEG.new('enkhuizen.jpg').gps.latitude # => 52.7197888888889
21
- EXIFR::JPEG.new('enkhuizen.jpg').gps.longitude # => 5.28397777777778
22
-
23
27
  == Logging warnings
24
28
  When EXIF information is malformed, a warning is logged to STDERR with
25
29
  the standard Ruby logger. Log to some other location by supplying an
@@ -50,4 +54,4 @@ examples at https://github.com/amberbit/xmp
50
54
  R.W. van 't Veer
51
55
 
52
56
  == Copyright
53
- Copyright (c) 2006-2015 - R.W. van 't Veer
57
+ Copyright (c) 2006-2017 - R.W. van 't Veer
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2013 - R.W. van 't Veer
1
+ # Copyright (c) 2006-2017 - R.W. van 't Veer
2
2
 
3
3
  require 'rake/testtask'
4
4
 
@@ -7,6 +7,7 @@ task :default => :test
7
7
  Rake::TestTask.new do |t|
8
8
  t.libs << 'lib' << 'tests'
9
9
  t.test_files = FileList['tests/*_test.rb']
10
+ t.warning = true
10
11
  end
11
12
 
12
13
  begin
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2006-2015 - R.W. van 't Veer
1
+ # Copyright (c) 2006-2017 - R.W. van 't Veer
2
2
 
3
3
  require 'logger'
4
4
 
@@ -10,6 +10,3 @@ module EXIFR
10
10
  class << self; attr_accessor :logger; end
11
11
  self.logger = Logger.new(STDERR)
12
12
  end
13
-
14
- require 'exifr/jpeg'
15
- require 'exifr/tiff'
@@ -1,6 +1,7 @@
1
- # Copyright (c) 2006-2015 - R.W. van 't Veer
1
+ # Copyright (c) 2006-2017 - R.W. van 't Veer
2
2
 
3
3
  require 'exifr'
4
+ require 'exifr/tiff'
4
5
  require 'stringio'
5
6
  require 'delegate'
6
7
 
@@ -1,4 +1,4 @@
1
- # Copyright (c) 2007-2015 - R.W. van 't Veer
1
+ # Copyright (c) 2007-2017 - R.W. van 't Veer
2
2
 
3
3
  require 'exifr'
4
4
  require 'rational'
@@ -245,16 +245,16 @@ module EXIFR
245
245
  self.mktime_proc = proc { |*args| Time.local(*args) }
246
246
 
247
247
  time_proc = proc do |value|
248
- value.map do |value|
249
- if value =~ /^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/
248
+ value.map do |v|
249
+ if v =~ /^(\d{4}):(\d\d):(\d\d) (\d\d):(\d\d):(\d\d)$/
250
250
  begin
251
251
  mktime_proc.call($1.to_i, $2.to_i, $3.to_i, $4.to_i, $5.to_i, $6.to_i)
252
252
  rescue => ex
253
- EXIFR.logger.warn("Bad date/time value #{value.inspect}: #{ex}")
253
+ EXIFR.logger.warn("Bad date/time value #{v.inspect}: #{ex}")
254
254
  nil
255
255
  end
256
256
  else
257
- value
257
+ v
258
258
  end
259
259
  end
260
260
  end
@@ -356,13 +356,13 @@ module EXIFR
356
356
  :date_time_original => time_proc,
357
357
  :date_time_digitized => time_proc,
358
358
  :date_time => time_proc,
359
- :orientation => proc { |v| v.map{|v| ORIENTATIONS[v]} },
359
+ :orientation => proc { |x| x.map{|y| ORIENTATIONS[y]} },
360
360
  :gps_latitude => degrees_proc,
361
361
  :gps_longitude => degrees_proc,
362
362
  :gps_dest_latitude => degrees_proc,
363
363
  :gps_dest_longitude => degrees_proc,
364
- :shutter_speed_value => proc { |v| v.map { |v| v.abs < 100 ? rational(1, (2 ** v).to_i) : nil } },
365
- :aperture_value => proc { |v| v.map { |v| round(1.4142 ** v, 1) } }
364
+ :shutter_speed_value => proc { |x| x.map { |y| y.abs < 100 ? rational(1, (2 ** y).to_i) : nil } },
365
+ :aperture_value => proc { |x| x.map { |y| round(1.4142 ** y, 1) } }
366
366
  })
367
367
 
368
368
  # Names for all recognized TIFF fields.
@@ -377,9 +377,9 @@ module EXIFR
377
377
  @ifds << ifd
378
378
  end
379
379
 
380
- @jpeg_thumbnails = @ifds.map do |ifd|
381
- if ifd.jpeg_interchange_format && ifd.jpeg_interchange_format_length
382
- start, length = ifd.jpeg_interchange_format, ifd.jpeg_interchange_format_length
380
+ @jpeg_thumbnails = @ifds.map do |v|
381
+ if v.jpeg_interchange_format && v.jpeg_interchange_format_length
382
+ start, length = v.jpeg_interchange_format, v.jpeg_interchange_format_length
383
383
  data[start..(start + length)]
384
384
  end
385
385
  end.compact
@@ -424,6 +424,14 @@ module EXIFR
424
424
  (super + TAGS + IFD.instance_methods(false)).uniq
425
425
  end
426
426
 
427
+ def encode_with(coder)
428
+ coder["ifds"] = @ifds
429
+ end
430
+
431
+ def to_yaml_properties
432
+ ['@ifds']
433
+ end
434
+
427
435
  class << self
428
436
  alias instance_methods_without_tiff_extras instance_methods
429
437
  def instance_methods(include_super = true) # :nodoc:
@@ -508,6 +516,10 @@ module EXIFR
508
516
  IFD.new(@data, @offset_next) if next?
509
517
  end
510
518
 
519
+ def encode_with(coder)
520
+ coder["fields"] = @fields
521
+ end
522
+
511
523
  def to_yaml_properties
512
524
  ['@fields']
513
525
  end
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (c) 2006-2015 - R.W. van 't Veer
3
+ # Copyright (c) 2006-2017 - R.W. van 't Veer
4
4
 
5
5
  require 'test_helper'
6
6
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (c) 2006-2015 - R.W. van 't Veer
3
+ # Copyright (c) 2006-2017 - R.W. van 't Veer
4
4
 
5
5
  require 'stringio'
6
6
  require 'pp'
@@ -24,7 +24,8 @@ TestCase = begin
24
24
  end
25
25
 
26
26
  $:.unshift("#{File.dirname(__FILE__)}/../lib")
27
- require 'exifr'
27
+ require 'exifr/jpeg'
28
+ require 'exifr/tiff'
28
29
  include EXIFR
29
30
 
30
31
  EXIFR.logger = Logger.new(StringIO.new)
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
- # Copyright (c) 2006-2015 - R.W. van 't Veer
3
+ # Copyright (c) 2006-2017 - R.W. van 't Veer
4
4
 
5
5
  require 'test_helper'
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: exifr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - R.W. van 't Veer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-01 00:00:00.000000000 Z
11
+ date: 2017-07-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: EXIF Reader is a module to read EXIF from JPEG and TIFF images.
14
14
  email: remco@remvee.net
@@ -57,25 +57,25 @@ licenses:
57
57
  metadata: {}
58
58
  post_install_message:
59
59
  rdoc_options:
60
- - "--title"
60
+ - --title
61
61
  - EXIF Reader for Ruby API Documentation
62
- - "--main"
62
+ - --main
63
63
  - README.rdoc
64
64
  require_paths:
65
65
  - lib
66
66
  required_ruby_version: !ruby/object:Gem::Requirement
67
67
  requirements:
68
- - - ">="
68
+ - - ! '>='
69
69
  - !ruby/object:Gem::Version
70
70
  version: '0'
71
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - ! '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.6.11
78
+ rubygems_version: 2.6.12
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Read EXIF from JPEG and TIFF images