dynamic_image 2.0.25 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20b1cfa9c326762d6b3d1bca63b4d8d65516cc266abd03f55328b4cca8086dc3
4
- data.tar.gz: 4a0496d6507534664dc8e39bc59358a2607df6aaaa966ee0eda3990f72cae8bf
3
+ metadata.gz: fd1d723cd97a91199630354e541d2a740aa41bae8ccb07554c1e723096a1b6dc
4
+ data.tar.gz: b4f5a8bf26b69da95543cb8885f5add2b72504ea88f83c4097bc1c25a13c622f
5
5
  SHA512:
6
- metadata.gz: c04933c776c41870142473869f983fd0d8d1a0b98602abf41b3fb5392f6d6ef8c4cb2f77c875044f32cbc7903d1dd9de06c644fcfc73c913bd414583ee27dfae
7
- data.tar.gz: 79ad9d9b59398d56765878253170eae968d2d8320c31b992fd9758ff2dd00b8131db1fae2746f6af359eeb8b9934dfe4020b30cd91602f1b6872302c95b2d1d6
6
+ metadata.gz: e2ba7e0be3c929f9da2b1c7311ae7a246341f081cc8057e8293417a8a73634ec5844d0ce7a691c3d5c771d99924b311c59a2a9b9bf2e2baae84675a3967a8614
7
+ data.tar.gz: '08cfc8124f2d6e2bd9d505315b1af7ed87e42ae4ff497a88fafd240e9594943721a6f72e7f196d5dffb1a43a1c8489e9b1b427e4042e149aedcf21a22f0506ba'
data/README.md CHANGED
@@ -31,6 +31,7 @@ and enumeration attacks.
31
31
  * Rails 5
32
32
  * Ruby 2.4+
33
33
  * ImageMagick command line tools
34
+ * ExifTool
34
35
 
35
36
  ## Documentation
36
37
 
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "mini_exiftool"
3
4
  require "mini_magick"
4
5
  require "dis"
5
6
  require "vector2d"
@@ -21,6 +21,12 @@ module DynamicImage
21
21
  @data = data
22
22
  end
23
23
 
24
+ def exif
25
+ raise DynamicImage::Errors::InvalidHeader unless valid_header?
26
+
27
+ MiniExiftool.new(string_io)
28
+ end
29
+
24
30
  def read
25
31
  raise DynamicImage::Errors::InvalidHeader unless valid_header?
26
32
 
@@ -39,7 +45,11 @@ module DynamicImage
39
45
  private
40
46
 
41
47
  def file_header
42
- @file_header ||= StringIO.new(@data, "rb").read(8)
48
+ @file_header ||= string_io.read(8)
49
+ end
50
+
51
+ def string_io
52
+ StringIO.new(@data, "rb")
43
53
  end
44
54
  end
45
55
  end
@@ -90,7 +90,10 @@ module DynamicImage
90
90
  end
91
91
 
92
92
  def convert_to_srgb(image, combined)
93
- combined.profile(srgb_profile) if image.data["profiles"].present?
93
+ if image.data["profiles"].present? &&
94
+ exif.colorspacedata&.strip&.downcase == record.colorspace
95
+ combined.profile(srgb_profile)
96
+ end
94
97
  combined.colorspace("sRGB") if record.cmyk?
95
98
  end
96
99
 
@@ -111,6 +114,10 @@ module DynamicImage
111
114
  end
112
115
  end
113
116
 
117
+ def exif
118
+ @exif ||= DynamicImage::ImageReader.new(record.data).exif
119
+ end
120
+
114
121
  def format
115
122
  @format ||= record_format
116
123
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DynamicImage
4
- VERSION = "2.0.25"
4
+ VERSION = "2.1.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dynamic_image
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.25
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inge Jørgensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-11 00:00:00.000000000 Z
11
+ date: 2020-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dis
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.0.6
33
+ - !ruby/object:Gem::Dependency
34
+ name: mini_exiftool
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '2.10'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '2.10'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: mini_magick
35
49
  requirement: !ruby/object:Gem::Requirement