gif2lgtm 1.0.5 → 1.0.6

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: 147366a739140e0c0a5ffa2c0fe6b94c0a11c39a123fb40b152583af88b580b1
4
- data.tar.gz: 557aaca25a43545122a89df3d62a3a44d7bf077f6d6cd1a7e17e32c603f11202
3
+ metadata.gz: 5adf856cf8328ff4a90700326d9ecca41330e136e109f5549142d810ea14057d
4
+ data.tar.gz: 78c206aa5d9b206cba5f99b980abe36a9a36251d1135b7ab50201bdba4a19f6d
5
5
  SHA512:
6
- metadata.gz: 5e0ca29a91dd26a0afb0be2c42ebf6c3dda186398715ea69ac70eb374daa56b5c9ecfac19809980ffe2089f129b2505c0fa1a3a1f55f6b64896c4cfa45ab4e27
7
- data.tar.gz: cc1414ee30976b8d0d556ce0f62564906740ae59e2ddc1482d41f935dd7195493fce1d1d6064075561f802536d15402cb25718cca608466f8b3821d39926f341
6
+ metadata.gz: 54809248ed8d48e5392294dd3befce233b8b836e6e987a670b08e5f9d6d4954f7d80696f3581ffe3bf66083fb7ae73eeb99e35ad8e9d07eff7c42e1e36f442c8
7
+ data.tar.gz: de994080814a2157108edb68ffeaa8990654eacc5f6c3f1e681e92237a6ee195b8842b1af5436b677f1983a734722fdc0ca9b4ae1c85b5f759d03bf5c3e98793
@@ -1,38 +1,32 @@
1
1
  module Gif2lgtm
2
2
  module Main
3
3
  module_function
4
- LOOP_COUNT = 0
4
+ LOOP_COUNT = 0 # infinite loop
5
5
 
6
6
  def start(img_path)
7
- gif = compsite!(img_path)
8
- create!(gif, img_path)
7
+ create(compsite(img_path), img_path)
9
8
  end
10
9
 
11
- def compsite!(img_path)
12
- gif = Magick::ImageList.new
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')
18
- lgtm = original_size_lgtm.resize_to_fit(images.first.columns, images.first.rows)
10
+ def compsite(img_path)
11
+ gif = Magick::ImageList.new
12
+ images = Magick::ImageList.new(img_path)
13
+ orig_size_lgtm = Magick::ImageList.new(File.expand_path('../../images/lgtm.png', __dir__))
14
+ lgtm = orig_size_lgtm.resize_to_fit(images.first.columns, images.first.rows)
19
15
 
20
16
  images.each do |image|
21
- blob = Magick::Image.from_blob(image.to_blob)[0]
22
- image = blob.composite(
23
- lgtm,
24
- Magick::CenterGravity,
25
- Magick::OverCompositeOp
26
- )
27
- gif.push(image)
17
+ gif.push(
18
+ Magick::Image.from_blob(image.to_blob)[0].composite(
19
+ lgtm,
20
+ Magick::CenterGravity,
21
+ Magick::OverCompositeOp))
28
22
  end
29
23
 
30
24
  gif
31
25
  end
32
26
 
33
- def create!(gif, img_path)
27
+ def create(gif, img_path)
34
28
  gif.iterations = LOOP_COUNT
35
- result_path = "#{File.dirname(img_path)}/lgtm#{SecureRandom.hex(5)}_#{File.basename(img_path)}"
29
+ result_path = "#{File.dirname(img_path)}/lgtm#{SecureRandom.hex(5)}_#{File.basename(img_path)}"
36
30
 
37
31
  gif.optimize_layers(Magick::OptimizeLayer).write(result_path)
38
32
  puts <<~MESSAGE
@@ -1,3 +1,3 @@
1
1
  module Gif2lgtm
2
- VERSION = '1.0.5'
2
+ VERSION = '1.0.6'
3
3
  end
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.5
4
+ version: 1.0.6
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-19 00:00:00.000000000 Z
11
+ date: 2019-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler