easyimg_utils 0.6.3 → 0.6.4
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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/easyimg_utils.rb +14 -7
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e12a8d7ad03689334172c8068730efef5acd22474b4f3b3a0d0f73994fa6f0c3
|
4
|
+
data.tar.gz: a2e24819dc0efd620fa16797286034f0cce333d1ef360eb6bb2e6a4b106ca36e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d5acd5bfef69e8cec1dc304f92e440070be9412d189fee2ce6d6c2b884593d9776b1bf04978dd572d62aea372fc0f636c6bf68c5dfd5338dcafbb9742647620
|
7
|
+
data.tar.gz: 4ea3afa5a48559a84d38e7806cf7ab27b3827ffcd1f6d2ef9cfbe0240f0d06e71987e9b2ef9316a2b510f8584ad605c67aa0512e41bd973c745d9c82ede407b1
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/easyimg_utils.rb
CHANGED
@@ -56,7 +56,7 @@ class EasyImgUtils
|
|
56
56
|
* animate Creates an animated gif e.g. animate('/tmp/a%d.png', '/tmp/b.gif')
|
57
57
|
* blur # e.g. blur(x: 231, y: 123, w: 85, h: 85)
|
58
58
|
* capture_screen # takes a screenshot of the desktop
|
59
|
-
* calc_resize # e.g.
|
59
|
+
* calc_resize # e.g. calc_resize '640x480' #=> 640x491
|
60
60
|
* center_crop # crops from the centre of an image. Usage center_crop(width, height)
|
61
61
|
* composite # overlay a smaller image on top of an image
|
62
62
|
* contrast # changes the intensity between lighter and darker elements
|
@@ -91,12 +91,13 @@ class EasyImgUtils
|
|
91
91
|
#
|
92
92
|
def self.calc_resize(s, s2)
|
93
93
|
|
94
|
-
a = s.split('x',2).map(&:to_i)
|
95
|
-
a2 = s2.split('x',2).map(&:to_i)
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
94
|
+
a = s.split('x',2).map(&:to_i)
|
95
|
+
a2 = s2.split('x',2).map(&:to_i)
|
96
|
+
i = a.index a.max
|
97
|
+
|
98
|
+
factor = a2[i] / a[i].to_f
|
99
|
+
|
100
|
+
s3 = a.map {|x| (x * factor).round}.join('x')
|
100
101
|
|
101
102
|
end
|
102
103
|
|
@@ -184,6 +185,12 @@ class EasyImgUtils
|
|
184
185
|
end
|
185
186
|
end
|
186
187
|
|
188
|
+
# calculates the new geometry after a resize
|
189
|
+
#
|
190
|
+
def calc_resize(geometry)
|
191
|
+
EasyImgUtils.calc_resize(info()[:geometry], geometry)
|
192
|
+
end
|
193
|
+
|
187
194
|
def capture_screen(quality: nil)
|
188
195
|
|
189
196
|
# defaults (silent=false, frame=false, descend=false,
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|