dragonfly_libvips 2.5.1 → 2.6.0

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: ff758f1df0a5d5e76957e22e4408a990e16e2e80627b4c1cc29fbe5fd8e2a6ac
4
- data.tar.gz: ccb9ffe5f11e224e4672994f84dd48e3dd5157205ccac4acc543b23c51c71230
3
+ metadata.gz: 507faa296ab3057e5b71b9fd85b0c9314ba77b748c2e23983dfb5bfbb46203f2
4
+ data.tar.gz: 47eec77cb209df469e4caf83a6102a4d0af6dc3452799bb441c305c8fe5f5faf
5
5
  SHA512:
6
- metadata.gz: 2c23ab254f3191a1c65db60aeab578aa3be6365d7cd24ce98a1ed80f08d3eed6557d4b9126cf9ff0b76e82e499d605c54dbf0c2ba4b79ac11fe7dfe67607f885
7
- data.tar.gz: 3c97170ab5e17b824843e2936f9ddd2298b4a8fc1a8f1d48f8ddff166cbf6a7f092f71e16e932fb58f2b600661a701898094d1c13194c5c6fd2d112cb103fe5c
6
+ metadata.gz: d13cd15073052fcbd5f7de59f5a6462662c98a083c1e348ebb4747a72fece6266261c9bac8ed2af97f693f930a2f3861c9a07d403dad49ec2cf1fa407fa6288b
7
+ data.tar.gz: ed631f529a74d9dbe21ae4810f24e9d237da89fa5495a400c81f7e2b2875f765be3370e10b541f459e5776fafac475f49614eb4d8edbf9712c4fddbb5cd76545
@@ -1,5 +1,9 @@
1
1
  name: Test
2
- on: [push, pull_request]
2
+ on:
3
+ pull_request:
4
+ branches: ["master"]
5
+ push:
6
+ branches: ["master"]
3
7
  jobs:
4
8
  test:
5
9
  runs-on: ubuntu-latest
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.1.2
1
+ 3.4.5
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 2.6.3
1
+ ruby 3.4.5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.6.0
4
+
5
+ * Add auto_profile configuration option by @asgerb
6
+ * Fix output not having the ICC profile embedded by @asgerb
7
+
3
8
  ## 2.5.1
4
9
 
5
10
  * Update all DragonflyLibvips.symbolize_keys to new syntax by @Bartuz
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_dependency "dragonfly", "~> 1.0"
23
23
  spec.add_dependency "ruby-vips", "~> 2.0", ">= 2.0.16"
24
+ spec.add_dependency "base64"
24
25
 
25
26
  spec.add_development_dependency "bundler" # , '~> 2.0'
26
27
  spec.add_development_dependency "rb-readline"
@@ -29,7 +30,6 @@ Gem::Specification.new do |spec|
29
30
  spec.add_development_dependency "minitest", "~> 5.0"
30
31
  spec.add_development_dependency "minitest-reporters"
31
32
  spec.add_development_dependency "rake"
32
-
33
33
  spec.add_development_dependency "lefthook"
34
34
  spec.add_development_dependency "rubocop-rails_config"
35
35
  end
@@ -29,6 +29,7 @@ module DragonflyLibvips
29
29
  "height" => height,
30
30
  "xres" => xres,
31
31
  "yres" => yres,
32
+ "has_alpha" => img.has_alpha?,
32
33
  "progressive" => (content.mime_type == "image/jpeg" && img.get("jpeg-multiscan") != 0)
33
34
  }
34
35
  end
@@ -32,7 +32,7 @@ module DragonflyLibvips
32
32
  output_options = options.fetch("output_options", {})
33
33
  if FORMATS_WITHOUT_PROFILE_SUPPORT.include?(format)
34
34
  output_options.delete("profile")
35
- else
35
+ elsif DragonflyLibvips.auto_profile
36
36
  output_options["profile"] ||= input_options.fetch("profile", EPROFILE_PATH)
37
37
  end
38
38
  output_options.delete("Q") unless /jpg|jpeg/i.match?(format.to_s)
@@ -40,6 +40,15 @@ module DragonflyLibvips
40
40
 
41
41
  img = ::Vips::Image.new_from_file(content.path, **DragonflyLibvips.symbolize_keys(input_options))
42
42
 
43
+ if output_options.include?("profile")
44
+ img = img.icc_transform(
45
+ output_options["profile"],
46
+ embedded: true,
47
+ intent: :relative,
48
+ black_point_compensation: true
49
+ )
50
+ end
51
+
43
52
  content.update(
44
53
  img.write_to_buffer(".#{format}", **DragonflyLibvips.symbolize_keys(output_options)),
45
54
  "name" => "temp.#{format}",
@@ -22,7 +22,7 @@ module DragonflyLibvips
22
22
  output_options = options.fetch("output_options", {})
23
23
  if FORMATS_WITHOUT_PROFILE_SUPPORT.include?(format)
24
24
  output_options.delete("profile")
25
- else
25
+ elsif DragonflyLibvips.auto_profile
26
26
  output_options["profile"] ||= input_options.fetch("profile", EPROFILE_PATH)
27
27
  end
28
28
  output_options.delete("Q") unless /jpg|jpeg/i.match?(format.to_s)
@@ -31,6 +31,15 @@ module DragonflyLibvips
31
31
  img = ::Vips::Image.new_from_file(content.path, **DragonflyLibvips.symbolize_keys(input_options))
32
32
  img = img.extract_area(x, y, width, height)
33
33
 
34
+ if output_options.include?("profile")
35
+ img = img.icc_transform(
36
+ output_options["profile"],
37
+ embedded: true,
38
+ intent: :relative,
39
+ black_point_compensation: true
40
+ )
41
+ end
42
+
34
43
  content.update(
35
44
  img.write_to_buffer(".#{format}", **DragonflyLibvips.symbolize_keys(output_options)),
36
45
  "name" => "temp.#{format}",
@@ -22,7 +22,7 @@ module DragonflyLibvips
22
22
  output_options = options.fetch("output_options", {})
23
23
  if FORMATS_WITHOUT_PROFILE_SUPPORT.include?(format)
24
24
  output_options.delete("profile")
25
- else
25
+ elsif DragonflyLibvips.auto_profile
26
26
  output_options["profile"] ||= input_options.fetch("profile", EPROFILE_PATH)
27
27
  end
28
28
  output_options.delete("Q") unless /jpg|jpeg/i.match?(format.to_s)
@@ -31,6 +31,15 @@ module DragonflyLibvips
31
31
  img = ::Vips::Image.new_from_file(content.path, **DragonflyLibvips.symbolize_keys(input_options))
32
32
  img = img.rot("d#{rotate}")
33
33
 
34
+ if output_options.include?("profile")
35
+ img = img.icc_transform(
36
+ output_options["profile"],
37
+ embedded: true,
38
+ intent: :relative,
39
+ black_point_compensation: true
40
+ )
41
+ end
42
+
34
43
  content.update(
35
44
  img.write_to_buffer(".#{format}", **DragonflyLibvips.symbolize_keys(output_options)),
36
45
  "name" => "temp.#{format}",
@@ -26,7 +26,7 @@ module DragonflyLibvips
26
26
  if content.mime_type == "application/pdf"
27
27
  input_options["dpi"] = input_options.fetch("dpi", DPI)
28
28
  input_options["page"] = input_options.fetch("page", 0)
29
- else
29
+ elsif DragonflyLibvips.auto_profile
30
30
  input_options.delete("page")
31
31
  input_options.delete("dpi")
32
32
  end
@@ -67,6 +67,15 @@ module DragonflyLibvips
67
67
  thumbnail_options = thumbnail_options.transform_keys { |k| k.to_sym } # symbolize
68
68
  thumb = ::Vips::Image.thumbnail(filename, dimensions.width.ceil, **DragonflyLibvips.symbolize_keys(thumbnail_options))
69
69
 
70
+ if output_options.include?("profile")
71
+ thumb = thumb.icc_transform(
72
+ output_options["profile"],
73
+ embedded: true,
74
+ intent: :relative,
75
+ black_point_compensation: true
76
+ )
77
+ end
78
+
70
79
  content.update(
71
80
  thumb.write_to_buffer(".#{format}", **DragonflyLibvips.symbolize_keys(output_options)),
72
81
  "name" => "temp.#{format}",
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DragonflyLibvips
4
- VERSION = "2.5.1"
4
+ VERSION = "2.6.0"
5
5
  end
@@ -54,6 +54,13 @@ module DragonflyLibvips
54
54
  webp
55
55
  ]
56
56
 
57
+ class << self
58
+ # Controls whether output images automatically get an ICC profile attached
59
+ attr_accessor :auto_profile
60
+ end
61
+
62
+ self.auto_profile ||= true
63
+
57
64
  private
58
65
  def self.stringify_keys(hash = {})
59
66
  hash.transform_keys { |k| k.to_s }
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dragonfly_libvips
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomas Celizna
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-02-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: dragonfly
@@ -44,6 +43,20 @@ dependencies:
44
43
  - - ">="
45
44
  - !ruby/object:Gem::Version
46
45
  version: 2.0.16
46
+ - !ruby/object:Gem::Dependency
47
+ name: base64
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ type: :runtime
54
+ prerelease: false
55
+ version_requirements: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
47
60
  - !ruby/object:Gem::Dependency
48
61
  name: bundler
49
62
  requirement: !ruby/object:Gem::Requirement
@@ -170,7 +183,6 @@ dependencies:
170
183
  - - ">="
171
184
  - !ruby/object:Gem::Version
172
185
  version: '0'
173
- description:
174
186
  email:
175
187
  - tomas.celizna@gmail.com
176
188
  executables: []
@@ -218,7 +230,6 @@ homepage: https://github.com/tomasc/dragonfly_libvips
218
230
  licenses:
219
231
  - MIT
220
232
  metadata: {}
221
- post_install_message:
222
233
  rdoc_options: []
223
234
  require_paths:
224
235
  - lib
@@ -233,8 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
233
244
  - !ruby/object:Gem::Version
234
245
  version: '0'
235
246
  requirements: []
236
- rubygems_version: 3.0.3
237
- signing_key:
247
+ rubygems_version: 3.6.9
238
248
  specification_version: 4
239
249
  summary: Dragonfly analysers and processors for libvips image processing library.
240
250
  test_files: []