active_storage-blurhash 0.1.4 → 0.1.5

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: 1d1b889b0115b9f1f5ecfcc3865a2a09a3b046529494f1356ce27602c2cb63ce
4
- data.tar.gz: c4c2a9c786cd8a926725dfd38f9063a021e9b600fda1707055983ff8a45a19a1
3
+ metadata.gz: d10bff7b9f51b5a7079c2e44fe8d411b6268879bf8b2276de1eb8c3e4d30b43c
4
+ data.tar.gz: 3120b4c55cdf29ff5dee38918dc1f638b9dcde9117fda46d55dd297040f893e7
5
5
  SHA512:
6
- metadata.gz: 046c45a6bcf58dd8cb6ff8c9b695138cd37de6eea42da1943ac058d94a73a815f5aa9a520c47d081f6e35842af079a93b5dd2c9889b2a4100ff41b2d094f94fb
7
- data.tar.gz: 9bd1b1ef735ec22b9d5f9aa054b0743e7706c3b0445cf6b39381247692e5018c739dcfc4c40f2427afb69488e06e0acb438f40e29c9777e9f2c188f1bfbfe30a
6
+ metadata.gz: f45ceb47085f58cbecce509cb29b8c37921a810380b99f97a06eab68724af1074cc5d189411f031bc89d53f754b0aa27d197c93760d7b380465b7946ccde7701
7
+ data.tar.gz: b1fe9bb935aabb37fe325ae6c72beac1b7f6b57413aeef375f51755fe621efa1180fcfc073db22f24069f9837b0705e23e9dcfadac971d3227e189ff0d7c6f5d
@@ -17,7 +17,7 @@ module ActiveStorage
17
17
  when 3
18
18
  @thumbnail
19
19
  else
20
- @thumbnail.extract_band(0, n: 3)
20
+ @thumbnail&.extract_band(0, n: 3)
21
21
  end
22
22
  end
23
23
 
@@ -5,13 +5,24 @@ module ActiveStorage
5
5
  delegate_missing_to :@thumbnail
6
6
 
7
7
  def initialize(image)
8
- @thumbnail = MiniMagick::Image.open(
9
- ImageProcessing::MiniMagick.source(image.path).resize_to_limit(200, 200).call.path
8
+ @thumbnail = ::Vips::Image.new_from_file(
9
+ ::ImageProcessing::Vips.source(image.filename).resize_to_limit(200, 200).call.path
10
10
  )
11
+
12
+ @thumbnail = case @thumbnail.bands
13
+ when 1
14
+ @thumbnail.bandjoin(Array.new(3 - @thumbnail.bands, @thumbnail))
15
+ when 2
16
+ @thumbnail.bandjoin(@thumbnail.extract_band(0))
17
+ when 3
18
+ @thumbnail
19
+ else
20
+ @thumbnail.extract_band(0, n: 3)
21
+ end
11
22
  end
12
23
 
13
24
  def pixels
14
- @thumbnail.get_pixels.flatten
25
+ @thumbnail.to_a.flatten
15
26
  end
16
27
  end
17
28
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveStorage
2
2
  module Blurhash
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.5"
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  module ActiveStorage
2
2
  module Blurhash
3
- VERSION = "0.1.3"
3
+ VERSION = "0.1.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_storage-blurhash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julian Rubisch
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-10 00:00:00.000000000 Z
10
+ date: 2025-04-16 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activestorage