dynamic_image 2.0.22 → 2.0.23
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a9eeb1b5378e17d2dcf9d6c0245df5386a1253dfdbefd0fff61fd5faeb2a1ee
|
4
|
+
data.tar.gz: 3156acfe1931d9530dc5c23d51716904feb2f1f16f00657cd9aa52c61d97cf94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d3c0d2fd1e238b181b8d7cd86ebb12c65ebbe37e606bf434c969584def13b968e0bbd66b845b553d65c7d8e9245f20a066b88ee66f523de87391adf285aa194a
|
7
|
+
data.tar.gz: 51eda1715d2eb18931256018f95dfe9f714817bda16601d5c1ded50778cc4a0a31d27ec00ffe3287a88205e1c49cea09c0d159594c8552a2a94084821ff403c1
|
@@ -43,7 +43,7 @@ module DynamicImage
|
|
43
43
|
# Normalizes the image.
|
44
44
|
#
|
45
45
|
# * Applies EXIF rotation
|
46
|
-
# *
|
46
|
+
# * Converts to sRGB
|
47
47
|
# * Strips metadata
|
48
48
|
# * Optimizes GIFs
|
49
49
|
# * Performs format conversion if the requested format is different
|
@@ -59,7 +59,7 @@ module DynamicImage
|
|
59
59
|
process_data do |image|
|
60
60
|
image.combine_options do |combined|
|
61
61
|
combined.auto_orient
|
62
|
-
combined
|
62
|
+
convert_to_srgb(image, combined)
|
63
63
|
yield(combined) if block_given?
|
64
64
|
optimize(combined)
|
65
65
|
end
|
@@ -73,6 +73,11 @@ module DynamicImage
|
|
73
73
|
gif? ? DynamicImage::ImageReader.new(image.coalesce.to_blob).read : image
|
74
74
|
end
|
75
75
|
|
76
|
+
def convert_to_srgb(image, combined)
|
77
|
+
combined.profile(srgb_profile) if image.data["profiles"].present?
|
78
|
+
combined.colorspace("sRGB") if record.cmyk?
|
79
|
+
end
|
80
|
+
|
76
81
|
def create_variant(size)
|
77
82
|
record.variants.create(
|
78
83
|
variant_params(size).merge(filename: record.filename,
|
@@ -113,10 +118,6 @@ module DynamicImage
|
|
113
118
|
DynamicImage::ImageSizing.new(record, uncropped: @uncropped)
|
114
119
|
end
|
115
120
|
|
116
|
-
def needs_colorspace_conversion?
|
117
|
-
record.cmyk?
|
118
|
-
end
|
119
|
-
|
120
121
|
def needs_format_conversion?
|
121
122
|
format != record_format
|
122
123
|
end
|
@@ -139,12 +140,8 @@ module DynamicImage
|
|
139
140
|
attr_reader :record
|
140
141
|
|
141
142
|
def record_format
|
142
|
-
{ "image/bmp" => "BMP",
|
143
|
-
"image/
|
144
|
-
"image/gif" => "GIF",
|
145
|
-
"image/jpeg" => "JPEG",
|
146
|
-
"image/pjpeg" => "JPEG",
|
147
|
-
"image/tiff" => "TIFF",
|
143
|
+
{ "image/bmp" => "BMP", "image/png" => "PNG", "image/gif" => "GIF",
|
144
|
+
"image/jpeg" => "JPEG", "image/pjpeg" => "JPEG", "image/tiff" => "TIFF",
|
148
145
|
"image/webp" => "WEBP" }[record.content_type]
|
149
146
|
end
|
150
147
|
|
@@ -152,6 +149,10 @@ module DynamicImage
|
|
152
149
|
raise DynamicImage::Errors::InvalidImage unless record.valid?
|
153
150
|
end
|
154
151
|
|
152
|
+
def srgb_profile
|
153
|
+
File.join(File.dirname(__FILE__), "profiles/sRGB_ICC_v4_Appearance.icc")
|
154
|
+
end
|
155
|
+
|
155
156
|
def variant_params(size)
|
156
157
|
crop_size, crop_start = image_sizing.crop_geometry(size)
|
157
158
|
|
Binary file
|
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.
|
4
|
+
version: 2.0.23
|
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-06-
|
11
|
+
date: 2020-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dis
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- lib/dynamic_image/model/validations.rb
|
163
163
|
- lib/dynamic_image/model/variants.rb
|
164
164
|
- lib/dynamic_image/processed_image.rb
|
165
|
+
- lib/dynamic_image/profiles/sRGB_ICC_v4_Appearance.icc
|
165
166
|
- lib/dynamic_image/routing.rb
|
166
167
|
- lib/dynamic_image/templates/show.html.erb
|
167
168
|
- lib/dynamic_image/version.rb
|