escpos-image 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a9b0ee34ebffb71648d1f88d9393ef8691655398
4
- data.tar.gz: 93c058d21c06840560942e325aec82a54ca57a9e
3
+ metadata.gz: b32b7a8a327a517beb7c504154b0135289717d6c
4
+ data.tar.gz: 8cec75b0d76afd3d48300ce28b6a0d4775d0d50d
5
5
  SHA512:
6
- metadata.gz: c2431794b2c3d3847ae4f6b085ede7b8287abdaadad9037f1b633e875b92325064135d7a24334f7a626d51a2e0ed09bda7b7431d215fcb072e7fb333ff65af46
7
- data.tar.gz: 4a7c21beb08c0bfe494792b327d5121933f1dc19debde67b5cd31efac962a2d13673363411025052015e79697fc34e2c7e193bc4de0dbc0782ca4aefa19552aa
6
+ metadata.gz: 7cb733d74f1898ea67a2115c22411120a7b3f174d0026aae89d2bf39fa65bf7f5f54a676e5264f9438e19834ad2399ff1aee651f5f1441b70bd3a6f36ff3e5b1
7
+ data.tar.gz: f0224fb12fb5de2d285166d933afe665c2ce6152e5cf78c8c88203c9844e7db159fb01413955ccf478e893b575ab61c33ad85162f7e5193df6e75345fdd8d5a7
data/README.md CHANGED
@@ -18,6 +18,10 @@ Or install it yourself as:
18
18
 
19
19
  $ gem install escpos-image
20
20
 
21
+ ## Examples
22
+
23
+ ![](https://github.com/escpos/escpos-image/blob/master/examples/IMG_20160610_232415_HDR.jpg)
24
+
21
25
  ## Usage
22
26
 
23
27
  ```ruby
@@ -25,7 +29,11 @@ Or install it yourself as:
25
29
 
26
30
  image = Escpos::Image.new 'path/to/image.png'
27
31
  # to use automatic conversion to monochrome format (requires mini_magick gem) use:
28
- image = Escpos::Image.new 'path/to/image.png', convert_to_monochrome: true
32
+ image = Escpos::Image.new 'path/to/image.png', {
33
+ convert_to_monochrome: true,
34
+ dither: true, # the default
35
+ extent: true, # the default
36
+ }
29
37
 
30
38
  @printer.write image.to_escpos
31
39
 
@@ -35,6 +43,7 @@ image = Escpos::Image.new 'path/to/image.png', convert_to_monochrome: true
35
43
  # with serial port printer it can be sent directly to the serial port
36
44
 
37
45
  @printer.to_base64 # returns base64 encoded ESC/POS data
46
+ ```
38
47
 
39
48
  ## Contributing
40
49
 
data/lib/escpos/image.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Escpos
2
2
  class Image
3
3
 
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
 
6
6
  def initialize(image_path, opts = {})
7
7
  if opts.fetch(:convert_to_monochrome, false)
@@ -55,6 +55,10 @@ module Escpos
55
55
 
56
56
  private
57
57
 
58
+ # !!!
59
+ # Please note that MiniMagick gem is not required _intentionally_
60
+ # This makes the gem more lightweight by making this dependency optional
61
+ # !!!
58
62
  def require_mini_magick!
59
63
  unless defined?(MiniMagick)
60
64
  begin
@@ -70,9 +74,9 @@ module Escpos
70
74
  image.flatten
71
75
  image.grayscale 'Rec709Luma'
72
76
  if opts.fetch(:dither, true)
73
- image.monochrome
74
- else
75
77
  image.monochrome '+dither'
78
+ else
79
+ image.monochrome
76
80
  end
77
81
  if opts.fetch(:extent, true)
78
82
  image.extent "#{(image.width/8.0).round*8}x#{(image.height/8.0).round*8}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: escpos-image
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Svoboda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-10 00:00:00.000000000 Z
11
+ date: 2016-09-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -96,6 +96,7 @@ files:
96
96
  - bin/console
97
97
  - bin/setup
98
98
  - escpos-image.gemspec
99
+ - examples/IMG_20160610_232415_HDR.jpg
99
100
  - lib/escpos/helpers.rb
100
101
  - lib/escpos/image.rb
101
102
  - test/fixtures/tux_alpha.png
@@ -122,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
123
  version: '0'
123
124
  requirements: []
124
125
  rubyforge_project:
125
- rubygems_version: 2.5.1
126
+ rubygems_version: 2.6.4
126
127
  signing_key:
127
128
  specification_version: 4
128
129
  summary: A ruby implementation of ESC/POS (thermal) printer image command specification.