micro_magick 0.0.7 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- YmJkMmI2NzI4MTk4ZDBiZTZjNmFkZDc4ZTljNWZjYzkwZTMyYzdmOQ==
5
- data.tar.gz: !binary |-
6
- Yzk2YzEyNTk2OTEzYzkyOWI1MGE4NTc3MGNiNmY0ZWI3OThiZDI0NA==
2
+ SHA1:
3
+ metadata.gz: d5fe2a80cd4fd39386b5427a88450816586f236b
4
+ data.tar.gz: 8c1904a65e0e4cd5569e42d94ad725d6a234b2ed
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- OTc4OGExNDUyOGRmMWFlZjIxODk3MGQ4Njg0ODRjMGUyODBlYzNjODQ5MjIy
10
- YmJmZGI0ZTY1NTI3Y2U4NDdkN2M1YmY3YzdmMjUyNDgzN2YwYjcxMTE0OThj
11
- MWJlNjFlZmUxYTIxMTgyZDQ4ZWVmOWQ3MGQ4YzI5YTg0ZWFkMmY=
12
- data.tar.gz: !binary |-
13
- NmI1ZmE4OTBlOTBlMGU4MjAxYzFmYjUzNTE2NGQ1OWE1NjEwMTRhYzAyNzUx
14
- NmI3M2EwZDJmMzZmMjM1ZGMyODFkNjhlM2I0OTg1YjZmZjBmNTgxZTdjZDlm
15
- NTI4ZWQzYWVhMGUwMjY0MzcyMTg2ZWJiOWViOTM0MjZmMTM2ZWI=
6
+ metadata.gz: f3ff709ef212a13c5286f47be04588b8746304b946d1594321aed5c23e7a46b9ceb460b475291fe50bc649e5a9f4c3aa19ab3d05d973a2f3707b133118ee8800
7
+ data.tar.gz: 4697bd37f648c0674a377e0df032763b742f226afe98aceb38a9da6a529222edacaff7ba9de0eed56673fe878b8feccccc16917d1148985dd8991d5de3b2396a
data/lib/micro_magick.rb CHANGED
@@ -11,16 +11,40 @@ module MicroMagick
11
11
  ArgumentError = Class.new(Error)
12
12
  CorruptImageError = Class.new(Error)
13
13
 
14
- def self.use_imagemagick
14
+ def self.use_imagemagick!
15
+ reset!
15
16
  @cmd_prefix = ''
16
17
  end
17
18
 
18
- def self.use_graphicsmagick
19
+ def self.use_graphicsmagick!
20
+ reset!
19
21
  @cmd_prefix = 'gm '
20
22
  end
21
23
 
24
+ def self.graphicsmagick?
25
+ cmd_prefix == 'gm '
26
+ end
27
+
28
+ def self.imagemagick?
29
+ !graphicsmagick?
30
+ end
31
+
22
32
  def self.reset!
23
- @cmd_prefix = nil
33
+ @cmd_prefix = @verbose_version = @version = nil
34
+ end
35
+
36
+ def self.verbose_version
37
+ @verbose_version ||= begin
38
+ cmd = graphicsmagick? ? %w(version) : %w(identify --version)
39
+ exec(cmd, true)
40
+ end
41
+ end
42
+
43
+ def self.version
44
+ @version ||= begin
45
+ m = verbose_version.split($/, 1).first.match(/([\d\.]{5,})/)
46
+ Gem::Version.new(m[1]) if m
47
+ end
24
48
  end
25
49
 
26
50
  def self.cmd_prefix
@@ -37,23 +61,21 @@ module MicroMagick
37
61
 
38
62
  def self.exec(cmds, return_stdout = false)
39
63
  final_cmd = cmd_prefix + cmds.join(' ')
40
- stdout = Open3.popen3(final_cmd) do |stdin, stdout, stderr|
41
- err = stderr.read.strip
42
- if err.size > 0
43
- error = if err =~ /unrecognized option/i
44
- ArgumentError
45
- elsif err =~ /corrupt/i
46
- CorruptImageError
47
- elsif err =~ /no such file or directory|unable to open/i
48
- NoSuchFile
49
- else
50
- Error
51
- end
52
- raise error, "#{final_cmd} failed: #{err}"
53
- end
54
- stdout.read.strip
64
+ stdout, stderr, status = Open3.capture3(final_cmd)
65
+ err = stderr.strip
66
+ if err.size > 0 || status != 0
67
+ error = if err =~ /unrecognized option/i
68
+ ArgumentError
69
+ elsif err =~ /corrupt/i
70
+ CorruptImageError
71
+ elsif err =~ /no such file or directory|unable to open/i
72
+ NoSuchFile
73
+ else
74
+ Error
75
+ end
76
+ raise error, "#{final_cmd} failed (#{status}): #{err}"
55
77
  end
56
- return_stdout ? stdout : final_cmd
78
+ return_stdout ? stdout.strip : final_cmd
57
79
  rescue Errno::ENOENT => e
58
80
  raise NoSuchFile, e.message
59
81
  end
@@ -1,54 +1,13 @@
1
1
  module MicroMagick
2
2
  class IdentifyParser
3
3
 
4
- attr_reader :results
4
+ DIMENSIONS_RE = /(\d+)x(\d+)/
5
5
 
6
+ attr_reader :width, :height
6
7
  def initialize(stdout)
7
- cleaned = stdout.encode('UTF-8', 'binary', :invalid => :replace, :undef => :replace, :replace => '')
8
- @lines = cleaned.split("\n").select { |ea| ea =~ /\S+:/ }
9
- if @lines.empty?
10
- @results = {}
11
- else
12
- @results = parse[:image] # < remove the "image" prefix.
13
- if (m = /(\d+)x(\d+)/.match(@results[:geometry]))
14
- @results[:width], @results[:height] = m[1].to_i, m[2].to_i
15
- end
8
+ if (m = stdout.match(DIMENSIONS_RE))
9
+ @width, @height = m[1].to_i, m[2].to_i
16
10
  end
17
11
  end
18
-
19
- def [](key)
20
- results[key_to_sym(key)]
21
- end
22
-
23
- def parse
24
- result = {}
25
- while true
26
- line = @lines.shift
27
- key, value = split(line)
28
- if @lines.first && indent(line) < indent(@lines.first)
29
- # The current line has a sub-section.
30
- result[key] = parse()
31
- else
32
- result[key] = value
33
- end
34
-
35
- # Next line is indented less than the current line:
36
- break if @lines.first.nil? || indent(line) > indent(@lines.first)
37
- end
38
- result
39
- end
40
-
41
- def indent(line)
42
- /\S/.match(line).begin(0)
43
- end
44
-
45
- def split(line)
46
- k, v = line.split(':', 2).map(&:strip)
47
- [key_to_sym(k), v]
48
- end
49
-
50
- def key_to_sym(key)
51
- key.is_a?(Symbol) ? key : key.strip.gsub(/[\b\W_-]+/, '_').downcase.to_sym
52
- end
53
12
  end
54
13
  end
@@ -11,16 +11,12 @@ module MicroMagick
11
11
  @output_options = []
12
12
  end
13
13
 
14
- def [](key)
15
- identify[key]
16
- end
17
-
18
14
  def width
19
- self[:width]
15
+ identify.width unless corrupt?
20
16
  end
21
17
 
22
18
  def height
23
- self[:height]
19
+ identify.height unless corrupt?
24
20
  end
25
21
 
26
22
  def corrupt?
@@ -100,8 +96,8 @@ module MicroMagick
100
96
 
101
97
  def identify
102
98
  @identify || begin
103
- cmd = ['identify', '-verbose', Shellwords.escape(input_file)]
104
- @identify = IdentifyParser.new(MicroMagick.exec(cmd, true)).results
99
+ cmd = ['identify', '-verbose', '-format', '%wx%h', Shellwords.escape(input_file)]
100
+ @identify = IdentifyParser.new(MicroMagick.exec(cmd, true))
105
101
  @corrupt = false
106
102
  rescue CorruptImageError => e
107
103
  @identify = {}
@@ -1,3 +1,3 @@
1
1
  module MicroMagick
2
- VERSION = '0.0.7'
2
+ VERSION = Gem::Version.new('1.0.0')
3
3
  end
data/test/393.JPG ADDED
Binary file
data/test/bad_exif.jpg ADDED
Binary file
File without changes
data/test/image_tests.rb CHANGED
@@ -5,9 +5,10 @@ module ImageTests
5
5
  def self.included spec_class
6
6
  spec_class.class_eval do
7
7
 
8
- let(:img) { MicroMagick::Convert.new('test/480x270.jpg') }
8
+ let(:imgfile) { 'test/480x270.jpg' }
9
+ let(:img) { MicroMagick::Convert.new(imgfile) }
9
10
 
10
- let(:corrupt) { MicroMagick::Convert.new('test/corrupt.jpg') }
11
+ let(:corrupt) { MicroMagick::Convert.new('test/borked.jpg') }
11
12
 
12
13
  # By using the block format, the tempfile will be closed and deleted:
13
14
  let(:outfile) { Tempfile.open(%w(out .jpg)) { |ea| ea.path } }
@@ -18,10 +19,24 @@ module ImageTests
18
19
  img.corrupt?.must_be_false
19
20
  end
20
21
 
22
+ def corrupt_checks_broken
23
+ MicroMagick.imagemagick? && MicroMagick.version < Gem::Version.new('6.7.0')
24
+ end
25
+
21
26
  it 'detects corrupt images properly' do
22
- corrupt.width.must_be_nil
23
- corrupt.height.must_be_nil
24
- corrupt.corrupt?.must_be_true
27
+ if corrupt_checks_broken
28
+ puts "skipping .corrupt? tests"
29
+ else
30
+ corrupt.width.must_be_nil
31
+ corrupt.height.must_be_nil
32
+ corrupt.corrupt?.must_be_true
33
+ end
34
+ end
35
+
36
+ it 'extracts image geometry for problematic JPGs' do
37
+ jpg = MicroMagick::Image.new('test/bad_exif.jpg')
38
+ jpg.width.must_equal(1944)
39
+ jpg.height.must_equal(2592)
25
40
  end
26
41
 
27
42
  it 'resizes to cropped square' do
@@ -38,8 +53,13 @@ module ImageTests
38
53
  img.strip
39
54
  command = img.write(outfile)
40
55
  command.must_equal "#{MicroMagick.cmd_prefix}convert test/480x270.jpg +profile \\* " + Shellwords.escape(outfile)
41
- i = MicroMagick::Image.new('test/480x270.jpg')
42
- i['Profile-EXIF'].must_be_nil
56
+
57
+ stripped = MicroMagick::Image.new(outfile)
58
+ stripped.corrupt?.must_be_false
59
+ stripped.width.must_equal img.width
60
+ stripped.height.must_equal img.height
61
+
62
+ File.stat(outfile).size.must_be :<, File.stat(imgfile).size
43
63
  end
44
64
 
45
65
  it 'crops properly' do
@@ -53,7 +73,7 @@ module ImageTests
53
73
  g.height.must_equal 128
54
74
 
55
75
  # make sure calling previous arguments don't leak into new calls:
56
- img.resize("64x64")
76
+ img.resize('64x64')
57
77
  command = img.write(outfile)
58
78
  command.must_equal "#{MicroMagick.cmd_prefix}convert -size 64x64 test/480x270.jpg -resize 64x64 " +
59
79
  Shellwords.escape(outfile)
@@ -2,7 +2,19 @@ require 'test_helper'
2
2
  require 'image_tests'
3
3
 
4
4
  describe 'Image tests under GraphicsMagick' do
5
- before { MicroMagick.use_graphicsmagick }
5
+ before { MicroMagick.use_graphicsmagick! }
6
+
7
+ it 'properly reports using graphicsmagick' do
8
+ MicroMagick.imagemagick?.must_equal false
9
+ MicroMagick.graphicsmagick?.must_equal true
10
+ end
11
+
12
+ it 'returns the correct GraphicsMagick version' do
13
+ # GraphicsMagick should be around 1.3.x-ish. See http://www.graphicsmagick.org/Changelog.html
14
+ MicroMagick.version.must_be :<, Gem::Version.new('1.4')
15
+ MicroMagick.version.must_be :>, Gem::Version.new('1.0')
16
+ end
17
+
6
18
  include ImageTests
7
19
  end
8
20
 
@@ -2,7 +2,20 @@ require 'test_helper'
2
2
  require 'image_tests'
3
3
 
4
4
  describe 'Image tests under ImageMagick' do
5
- before { MicroMagick.use_imagemagick }
5
+ before { MicroMagick.use_imagemagick! }
6
+
7
+ it 'properly reports using imagemagick' do
8
+ MicroMagick.imagemagick?.must_equal true
9
+ MicroMagick.graphicsmagick?.must_equal false
10
+ end
11
+
12
+ it 'returns the correct ImageMagick version' do
13
+ # ImageMagick should be around 6.9.x-ish. See http://www.imagemagick.org/script/changelog.php
14
+ puts MicroMagick.version
15
+ MicroMagick.version.must_be :<, Gem::Version.new('7.0.0')
16
+ MicroMagick.version.must_be :>, Gem::Version.new('6.3.0')
17
+ end
18
+
6
19
  include ImageTests
7
20
  end
8
21
 
@@ -9,12 +9,12 @@ describe MicroMagick do
9
9
  end
10
10
 
11
11
  it 'uses GraphicsMagick when set explicitly' do
12
- MicroMagick.use_graphicsmagick
12
+ MicroMagick.use_graphicsmagick!
13
13
  MicroMagick.cmd_prefix.must_equal 'gm '
14
14
  end
15
15
 
16
16
  it 'uses ImageMagick when set explicitly' do
17
- MicroMagick.use_imagemagick
17
+ MicroMagick.use_imagemagick!
18
18
  MicroMagick.cmd_prefix.must_equal ''
19
19
  end
20
20
 
data/test/test_helper.rb CHANGED
@@ -1,3 +1,8 @@
1
1
  require 'minitest/autorun'
2
2
  require 'minitest/great_expectations'
3
3
  require 'micro_magick'
4
+
5
+ unless ENV['CI']
6
+ require 'minitest/reporters'
7
+ Minitest::Reporters.use! [Minitest::Reporters::SpecReporter.new]
8
+ end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: micro_magick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew McEachen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-02-09 00:00:00.000000000 Z
11
+ date: 2015-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ! '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: yard
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ! '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest-great_expectations
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitest-reporters
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: ''
@@ -91,9 +91,10 @@ files:
91
91
  - lib/micro_magick/identify_parser.rb
92
92
  - lib/micro_magick/image.rb
93
93
  - lib/micro_magick/version.rb
94
+ - test/393.JPG
94
95
  - test/480x270.jpg
95
- - test/corrupt.jpg
96
- - test/identify_parser_test.rb
96
+ - test/bad_exif.jpg
97
+ - test/borked.jpg
97
98
  - test/image_tests.rb
98
99
  - test/micro_gmagick_test.rb
99
100
  - test/micro_imagick_test.rb
@@ -108,24 +109,25 @@ require_paths:
108
109
  - lib
109
110
  required_ruby_version: !ruby/object:Gem::Requirement
110
111
  requirements:
111
- - - ! '>='
112
+ - - ">="
112
113
  - !ruby/object:Gem::Version
113
114
  version: '0'
114
115
  required_rubygems_version: !ruby/object:Gem::Requirement
115
116
  requirements:
116
- - - ! '>='
117
+ - - ">="
117
118
  - !ruby/object:Gem::Version
118
119
  version: '0'
119
120
  requirements: []
120
121
  rubyforge_project:
121
- rubygems_version: 2.2.0
122
+ rubygems_version: 2.4.5.1
122
123
  signing_key:
123
124
  specification_version: 4
124
125
  summary: Simple and efficient ImageMagick/GraphicsMagick ruby wrapper
125
126
  test_files:
127
+ - test/393.JPG
126
128
  - test/480x270.jpg
127
- - test/corrupt.jpg
128
- - test/identify_parser_test.rb
129
+ - test/bad_exif.jpg
130
+ - test/borked.jpg
129
131
  - test/image_tests.rb
130
132
  - test/micro_gmagick_test.rb
131
133
  - test/micro_imagick_test.rb
@@ -1,185 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe MicroMagick::IdentifyParser do
4
- describe 'simple parsing functions' do
5
- let(:ip) { MicroMagick::IdentifyParser.new('') }
6
- it 'converts keys to expected symbols' do
7
- ip.key_to_sym('Image').must_equal :image
8
- ip.key_to_sym('Channel Depths').must_equal :channel_depths
9
- ip.key_to_sym('JPEG-Quality').must_equal :jpeg_quality
10
- ip.key_to_sym('Y Cb Cr Positioning').must_equal :y_cb_cr_positioning
11
- ip.key_to_sym('Profile-EXIF').must_equal :profile_exif
12
- end
13
-
14
- it 'determines line indent properly' do
15
- ip.indent('Image: out.jpeg').must_equal 0
16
- ip.indent(' Channel Depths:').must_equal 2
17
- ip.indent(' Blue:').must_equal 4
18
- end
19
- end
20
-
21
- describe 'with expected output' do
22
- let(:ip) do
23
- MicroMagick::IdentifyParser.new(<<-OUT)
24
- Image: /tmp/input.jpg
25
- Format: JPEG (Joint Photographic Experts Group JFIF format)
26
- Mime type: image/jpeg
27
- Class: DirectClass
28
- Geometry: 1152x2048+0+0
29
- Resolution: 72x72
30
- Print size: 16x28.4444
31
- Units: PixelsPerInch
32
- Type: TrueColor
33
- Endianess: Undefined
34
- Colorspace: sRGB
35
- Depth: 8-bit
36
- Channel depth:
37
- red: 8-bit
38
- green: 8-bit
39
- blue: 8-bit
40
- Channel statistics:
41
- Red:
42
- min: 0 (0)
43
- max: 255 (1)
44
- mean: 133.986 (0.525437)
45
- standard deviation: 54.1069 (0.212184)
46
- kurtosis: -0.874804
47
- skewness: -0.488666
48
- Green:
49
- min: 0 (0)
50
- max: 255 (1)
51
- mean: 119.681 (0.469337)
52
- standard deviation: 64.5707 (0.253218)
53
- kurtosis: -1.43104
54
- skewness: -0.207503
55
- Blue:
56
- min: 0 (0)
57
- max: 255 (1)
58
- mean: 102.697 (0.402734)
59
- standard deviation: 75.4283 (0.295797)
60
- kurtosis: -1.69738
61
- skewness: 0.0278036
62
- Image statistics:
63
- Overall:
64
- min: 0 (0)
65
- max: 255 (1)
66
- mean: 118.788 (0.465836)
67
- standard deviation: 65.2849 (0.256019)
68
- kurtosis: -1.25648
69
- skewness: -0.301872
70
- Rendering intent: Perceptual
71
- Gamma: 0.454545
72
- Chromaticity:
73
- red primary: (0.64,0.33)
74
- green primary: (0.3,0.6)
75
- blue primary: (0.15,0.06)
76
- white point: (0.3127,0.329)
77
- Background color: white
78
- Border color: srgb(223,223,223)
79
- Matte color: grey74
80
- Transparent color: black
81
- Interlace: None
82
- Intensity: Undefined
83
- Compose: Over
84
- Page geometry: 1152x2048+0+0
85
- Dispose: Undefined
86
- Iterations: 0
87
- Compression: JPEG
88
- Quality: 94
89
- Orientation: TopLeft
90
- Properties:
91
- date:create: 2014-02-09T08:59:26-08:00
92
- date:modify: 2014-02-09T08:59:25-08:00
93
- exif:ApertureValue: 228/100
94
- exif:BrightnessValue: 105984/65536
95
- exif:ColorSpace: 1
96
- exif:ComponentsConfiguration: 1, 2, 3, 0
97
- exif:Compression: 6
98
- exif:DateTime: 2014:02:07 08:38:21
99
- exif:DateTimeDigitized: 2014:02:07 08:38:21
100
- exif:DateTimeOriginal: 2014:02:07 08:38:21
101
- exif:ExifImageLength: 2048
102
- exif:ExifImageWidth: 1152
103
- exif:ExifOffset: 230
104
- exif:ExifVersion: 48, 50, 50, 48
105
- exif:ExposureBiasValue: 0/10
106
- exif:ExposureMode: 0
107
- exif:ExposureProgram: 2
108
- exif:ExposureTime: 1/25
109
- exif:Flash: 0
110
- exif:FlashPixVersion: 48, 49, 48, 48
111
- exif:FNumber: 220/100
112
- exif:FocalLength: 420/100
113
- exif:FocalLengthIn35mmFilm: 31
114
- exif:GPSAltitude: 0/1000
115
- exif:GPSAltitudeRef: 0
116
- exif:GPSDateStamp: 2014:02:07
117
- exif:GPSInfo: 722
118
- exif:GPSLatitude: 37/1, 46/1, 341802/10000
119
- exif:GPSLatitudeRef: N
120
- exif:GPSLongitude: 122/1, 25/1, 6225/10000
121
- exif:GPSLongitudeRef: W
122
- exif:GPSProcessingMethod: ASCII
123
- exif:GPSTimeStamp: 16/1, 38/1, 11/1
124
- exif:GPSVersionID: 2, 2, 0, 0
125
- exif:ImageLength: 1152
126
- exif:ImageUniqueID: 9e6076155a3bd1ce0000000000000000
127
- exif:ImageWidth: 2048
128
- exif:InteroperabilityIndex: R98
129
- exif:InteroperabilityOffset: 948
130
- exif:InteroperabilityVersion: 48, 49, 48, 48
131
- exif:ISOSpeedRatings: 125
132
- exif:JPEGInterchangeFormat: 1072
133
- exif:JPEGInterchangeFormatLength: 4729
134
- exif:LightSource: 0
135
- exif:Make: SAMSUNG
136
- exif:MaxApertureValue: 228/100
137
- exif:MeteringMode: 1
138
- exif:Model: SCH-I545
139
- exif:Orientation: 1
140
- exif:ResolutionUnit: 2
141
- exif:SceneCaptureType: 0
142
- exif:SceneType: 1
143
- exif:SensingMethod: 2
144
- exif:ShutterSpeedValue: 304394/65536
145
- exif:Software: Google
146
- exif:thumbnail:ResolutionUnit: 2
147
- exif:thumbnail:XResolution: 72/1
148
- exif:thumbnail:YResolution: 72/1
149
- exif:WhiteBalance: 0
150
- exif:XResolution: 72/1
151
- exif:YCbCrPositioning: 1
152
- exif:YResolution: 72/1
153
- jpeg:colorspace: 2
154
- jpeg:sampling-factor: 2x2,1x1,1x1
155
- signature: 2e969ff76481f84c85031e191ee902825bf6c2a12fb6083da57633326cde2bef
156
- Profiles:
157
- Profile-exif: 5808 bytes
158
- Profile-xmp: 325 bytes
159
- Artifacts:
160
- filename: /Users/mrm/Downloads/20140207_083822.jpg
161
- verbose: true
162
- Tainted: False
163
- Filesize: 227KB
164
- Number pixels: 2.359M
165
- Pixels per second: 29.49MB
166
- User time: 0.070u
167
- Elapsed time: 0:01.080
168
- Version: ImageMagick 6.8.7-7 Q16 x86_64 2013-11-27 http://www.imagemagick.org
169
- OUT
170
- end
171
-
172
- it 'extracts width and depth from geometry' do
173
- ip[:width].must_equal 1152
174
- ip[:height].must_equal 2048
175
- end
176
-
177
- it 'extracts sub-sections properly' do
178
- ip[:channel_depth][:red].must_equal '8-bit'
179
- ip[:channel_depth][:green].must_equal '8-bit'
180
- ip[:channel_depth][:blue].must_equal '8-bit'
181
- ip[:artifacts][:verbose].must_equal 'true'
182
- end
183
- end
184
-
185
- end