mini_magick 4.7.2 → 4.8.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.
Potentially problematic release.
This version of mini_magick might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/mini_magick/image.rb +13 -7
- data/lib/mini_magick/tool.rb +1 -1
- data/lib/mini_magick/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 49a53e90d9387b9fa7dbb83e10e08fcc7650e2e8
|
4
|
+
data.tar.gz: af2fecfe830084869b34bd41b6b2077b5ec4218a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa011122b74d076892ae48198f56b71ab809f20bdca8d56c1a0754ccd7711c03093bcd6721b6b15aedd4599ede040ccb3d23d4947dbf4748f7531b5e68f0e5bb
|
7
|
+
data.tar.gz: 2507b667f71982f46c181a4b0ae8c55f94a2d01338f035a98e0df38ff18639b39a957bbd754c6b481e61c0a95f446e16e157e4b9562c1551f2696651c7ef22f0
|
data/lib/mini_magick/image.rb
CHANGED
@@ -76,9 +76,12 @@ module MiniMagick
|
|
76
76
|
# @param path_or_url [String] Either a local file path or a URL that
|
77
77
|
# open-uri can read
|
78
78
|
# @param ext [String] Specify the extension you want to read it as
|
79
|
+
# @param options [Hash] Specify options for the open method
|
79
80
|
# @return [MiniMagick::Image] The loaded image
|
80
81
|
#
|
81
|
-
def self.open(path_or_url, ext = nil)
|
82
|
+
def self.open(path_or_url, ext = nil, options = {})
|
83
|
+
options, ext = ext, nil if ext.is_a?(Hash)
|
84
|
+
|
82
85
|
ext ||=
|
83
86
|
if File.exist?(path_or_url)
|
84
87
|
File.extname(path_or_url)
|
@@ -88,7 +91,7 @@ module MiniMagick
|
|
88
91
|
|
89
92
|
ext.sub!(/:.*/, '') # hack for filenames or URLs that include a colon
|
90
93
|
|
91
|
-
Kernel.open(path_or_url, "rb") do |file|
|
94
|
+
Kernel.open(path_or_url, "rb", options) do |file|
|
92
95
|
read(file, ext)
|
93
96
|
end
|
94
97
|
end
|
@@ -343,11 +346,14 @@ module MiniMagick
|
|
343
346
|
#
|
344
347
|
# @return [Array] Matrix of each color of each pixel
|
345
348
|
def get_pixels
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
349
|
+
convert = MiniMagick::Tool::Convert.new
|
350
|
+
convert << path
|
351
|
+
convert.depth(8)
|
352
|
+
convert << "RGB:-"
|
353
|
+
|
354
|
+
# Do not use `convert.call` here. We need the whole binary (unstripped) output here.
|
355
|
+
shell = MiniMagick::Shell.new
|
356
|
+
output, * = shell.run(convert.command)
|
351
357
|
|
352
358
|
pixels_array = output.unpack("C*")
|
353
359
|
pixels = pixels_array.each_slice(3).each_slice(width).to_a
|
data/lib/mini_magick/tool.rb
CHANGED
data/lib/mini_magick/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mini_magick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Corey Johnson
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2017-06
|
16
|
+
date: 2017-07-06 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: rake
|