You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found a problem with writing pngs with color mode 0 and 1-bit depth when using ruby 2.0.0p247. The error does not occur with ruby versions < 2. This is an example of how to reproduce it:
appel:code niels$ ruby --version
ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.5.0]
appel:code niels$ irb -r qrencoder
irb(main):001:0> qrcode = QREncoder.encode("Hello world!")
=>#<QREncoder::QRCode:0x007fd1a98417a0>
irb(main):002:0> qrcode.save_png("/tmp/helloqr.png")
=>#<File:/tmp/helloqr.png (closed)>
irb(main):003:0>exit
appel:code niels$ rbenv local 2.0.0-p247
appel:code niels$ rbenv rehash
appel:code niels$ ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.5.0]
appel:code niels$ irb -r qrencoder
irb(main):001:0> qrcode = QREncoder.encode("Hello world!")
=>#<QREncoder::QRCode:0x007fcf43825d10>
irb(main):002:0> qrcode.save_png("/tmp/helloqr2.png")
ChunkyPNG::NotSupported: No encoder found for color mode 0 and 1-bit depth!
from /Users/niels/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/chunky_png-1.2.5/lib/chunky_png/canvas/png_encoding.rb:370:in `encode_png_pixels_to_scanline_method' from /Users/niels/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/chunky_png-1.2.5/lib/chunky_png/canvas/png_encoding.rb:210:in `encode_png_image_pass_to_stream' from /Users/niels/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/chunky_png-1.2.5/lib/chunky_png/canvas/png_encoding.rb:174:in `encode_png_image_without_interlacing' from /Users/niels/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/chunky_png-1.2.5/lib/chunky_png/canvas/png_encoding.rb:161:in `encode_png_pixelstream'
from /Users/niels/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/chunky_png-1.2.5/lib/chunky_png/canvas/png_encoding.rb:85:in `to_datastream' from /Users/niels/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/chunky_png-1.2.5/lib/chunky_png/image.rb:62:in `to_datastream' from /Users/niels/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/chunky_png-1.2.5/lib/chunky_png/canvas/png_encoding.rb:35:in `write' from /Users/niels/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/chunky_png-1.2.5/lib/chunky_png/canvas/png_encoding.rb:43:in `block in save'
from /Users/niels/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/chunky_png-1.2.5/lib/chunky_png/canvas/png_encoding.rb:43:in `open' from /Users/niels/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/chunky_png-1.2.5/lib/chunky_png/canvas/png_encoding.rb:43:in `save' from /Users/niels/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/qrencoder-1.4.1/lib/qrencoder/png.rb:27:in `method_missing' from /Users/niels/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/qrencoder-1.4.1/lib/qrencoder/qrcode.rb:11:in `save_png'
from (irb):2
from /Users/niels/.rbenv/versions/2.0.0-p247/bin/irb:12:in `<main>'irb(main):003:0>
The text was updated successfully, but these errors were encountered:
This is weird. The test suite, with includes an example using this mode, works fine for me on ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]
I am suspecting a weird interaction issue with the QR code library you're using. Can you figure out what the exact arguments are (including type) that chunky_png is called with from that library?
with a margin of 4, pixels_per_module = 1, background = 4294967295, width = 29, and a canvas is a < ChunkyPNG::Image 29x29 [ [#ffffff #ffffff .... ] ... ]
and then it calls png.save(path), where path is a string.
I found a problem with writing pngs with color mode 0 and 1-bit depth when using ruby 2.0.0p247. The error does not occur with ruby versions < 2. This is an example of how to reproduce it:
The text was updated successfully, but these errors were encountered: