img2zpl 1.0.0 → 1.0.1

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: 5dc00b95a89a63d7e2464f9564224043d229702fa2ee34f867f87588c6ff7446
4
- data.tar.gz: 32e08dbe2a982507a56d3c71c421bd396351219d44b7e0394eccb50a172048e4
3
+ metadata.gz: 5b6d9b924895cd320a4925805a90fafc549c1802154417b3c40de23f521050b6
4
+ data.tar.gz: 3edfa63c167c715682b837a141301fdb6a45a8a4cd3fb2a47821e084eef3e779
5
5
  SHA512:
6
- metadata.gz: 4f0a368e1c0caad2bfd9d6ccba1e35104cf3e17a80b72aec71aa58df88f8ede49b63a8addc53c21dc9d82ea6c9bc047bc0642da73d4df18fe90e8cf1891b99f0
7
- data.tar.gz: 105c15388445dfea07ed5e0b40d5e7f4b4739cb52661ad9f12d68641180d49904bb737de78f5cd657247d5e331aea043fafb8b76948aad27a43371b2eee77eea
6
+ metadata.gz: cb307f865a49b70e95d877d3039530c8b818dd80396f435139549449500739b15cac64e8e6565656c172a5e5237255a32b303ecce35723a1153cb7a2689edbb6
7
+ data.tar.gz: e73f9857dfaeeee4e33e552ff24dceed221480b4ef5b6c82693c9e7c5c1b51bb9001a40957ea1ad89693690d0c5508cba7c36600802a5b899bb60685effd82d5
@@ -1,7 +1,11 @@
1
- ### v1.0.x (next)
1
+ ### v1.0.1 (next)
2
2
 
3
3
  * Your contribution here
4
4
 
5
+ ### v1.0.1 (2019/11/05)
6
+
7
+ * [#5](https://github.com/mtking2/img2zpl/pull/5): Fix artifact bug & improve compression - [@mtking2](https://github.com/mtking2).
8
+
5
9
  ### v1.0.0 (2019/10/31)
6
10
 
7
11
  * [#4](https://github.com/mtking2/img2zpl/pull/4): Add ability to invert images - [@mtking2](https://github.com/mtking2).
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # img2zpl
2
2
 
3
- [![gem](https://img.shields.io/gem/v/img2zpl)](https://rubygems.org/gems/img2zpl)
3
+ [![gem](https://img.shields.io/gem/v/img2zpl?color=orange)](https://rubygems.org/gems/img2zpl)
4
4
  [![downloads](https://img.shields.io/gem/dt/img2zpl?color=brightgreen)](https://rubygems.org/gems/img2zpl)
5
5
 
6
6
  Ruby library to convert images to usable & printable ZPL code
@@ -33,10 +33,11 @@ The `Img2Zpl::Image` class inherits from the `MiniMagick::Image` class provied b
33
33
 
34
34
  **Example**:
35
35
  ```ruby
36
- img = Img2Zpl::Image.open('foo.jpg')
36
+ img = Img2Zpl::Image.open('foo.png')
37
37
 
38
- img.resize '100x100'
38
+ img.flatten
39
39
  img.trim
40
+ img.resize '100x100'
40
41
 
41
42
  zpl = img.to_zpl
42
43
  ```
@@ -11,8 +11,10 @@ module Img2Zpl
11
11
  r, g, b = column.map(&:to_i)
12
12
  b_dot, w_dot = invert ? %w(1 0) : %w(0 1)
13
13
  byte << ((r + g + b) > (black_threshold * 765) ? b_dot : w_dot)
14
- if (i % 8).zero?
15
- line << byte.to_i(2).to_s(16).upcase.rjust(2, '0')
14
+
15
+ if ((i+1) % 8).zero? || i == (width-1)
16
+ line_str = byte.ljust(8, '0').to_i(2).to_s(16).upcase.rjust(2, '0')
17
+ line << line_str
16
18
  byte = ''
17
19
  end
18
20
  end
@@ -56,7 +58,7 @@ module Img2Zpl
56
58
 
57
59
  def _compress(data)
58
60
  data.gsub!(/([\da-zA-Z])(\1+)/) do |m|
59
- "#{_reduce(m.length)}#{$1}"
61
+ m.length == 2 ? m : "#{_reduce(m.length)}#{$1}"
60
62
  end
61
63
  end
62
64
 
@@ -1,3 +1,3 @@
1
1
  module Img2Zpl
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: img2zpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael King
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-31 00:00:00.000000000 Z
11
+ date: 2019-11-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mini_magick