gif2lgtm 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/gif2lgtm/main.rb +11 -10
- data/lib/gif2lgtm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 147366a739140e0c0a5ffa2c0fe6b94c0a11c39a123fb40b152583af88b580b1
|
4
|
+
data.tar.gz: 557aaca25a43545122a89df3d62a3a44d7bf077f6d6cd1a7e17e32c603f11202
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e0ca29a91dd26a0afb0be2c42ebf6c3dda186398715ea69ac70eb374daa56b5c9ecfac19809980ffe2089f129b2505c0fa1a3a1f55f6b64896c4cfa45ab4e27
|
7
|
+
data.tar.gz: cc1414ee30976b8d0d556ce0f62564906740ae59e2ddc1482d41f935dd7195493fce1d1d6064075561f802536d15402cb25718cca608466f8b3821d39926f341
|
data/Gemfile.lock
CHANGED
data/lib/gif2lgtm/main.rb
CHANGED
@@ -3,15 +3,18 @@ module Gif2lgtm
|
|
3
3
|
module_function
|
4
4
|
LOOP_COUNT = 0
|
5
5
|
|
6
|
-
def start(
|
7
|
-
gif = compsite!(
|
8
|
-
create!(gif,
|
6
|
+
def start(img_path)
|
7
|
+
gif = compsite!(img_path)
|
8
|
+
create!(gif, img_path)
|
9
9
|
end
|
10
10
|
|
11
|
-
def compsite!(
|
11
|
+
def compsite!(img_path)
|
12
12
|
gif = Magick::ImageList.new
|
13
|
-
images = Magick::ImageList.new(
|
14
|
-
|
13
|
+
images = Magick::ImageList.new(img_path)
|
14
|
+
|
15
|
+
dir_path = caller[0][/^(.+?):\d+?:in.*/, 1].split('/')
|
16
|
+
dir_path.pop(3)
|
17
|
+
original_size_lgtm = Magick::ImageList.new(dir_path.join('/') + '/images/lgtm.png')
|
15
18
|
lgtm = original_size_lgtm.resize_to_fit(images.first.columns, images.first.rows)
|
16
19
|
|
17
20
|
images.each do |image|
|
@@ -27,11 +30,9 @@ module Gif2lgtm
|
|
27
30
|
gif
|
28
31
|
end
|
29
32
|
|
30
|
-
def create!(gif,
|
33
|
+
def create!(gif, img_path)
|
31
34
|
gif.iterations = LOOP_COUNT
|
32
|
-
|
33
|
-
dir_path = File.dirname(image_path)
|
34
|
-
result_path = "#{dir_path}/lgtm_#{random}_#{File.basename(image_path)}"
|
35
|
+
result_path = "#{File.dirname(img_path)}/lgtm#{SecureRandom.hex(5)}_#{File.basename(img_path)}"
|
35
36
|
|
36
37
|
gif.optimize_layers(Magick::OptimizeLayer).write(result_path)
|
37
38
|
puts <<~MESSAGE
|
data/lib/gif2lgtm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gif2lgtm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iavivai
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|