Giter Club home page Giter Club logo

Comments (2)

willglynn avatar willglynn commented on July 17, 2024

Hmm. Well, you have --with-jpeg, which IIRC is the only zbar flag ruby-zbar can notice. If FFI isn't exploding, either by raising exceptions or crashing, I'd guess that calls to zbar are happening properly, and that the failed detection has more to do with libzbar than the Ruby wrapper.

Five ideas:

  1. Call File.read(jpg, :binmode => true), instead of just File.read(jpg). By default, Ruby will treat it as text, and possibly garbling the bits as it changes encodings.
  2. Call Zbar.verbosity = 100, and see if you get anything on stderr.
  3. Cut out the JPEG -> Y800 step inside Zbar. Take an image that works in development but fails in production, convert it to .pgm ahead of time, and call ZBar::Image.from_pgm() instead.
  4. Try invoking the production copy of libzbar on the image without Ruby. zbar-0.10/examples/ contains some simple C/C++ binaries, and knowing if they work or not would help narrow down the issue.
  5. Upgrade your Mac to 1.9.2, at least for that project, using rvm. That's a good idea anyway, and would nail down any other 1.9 gotchas.

ruby-zbar works on 1.9.2, at least on my Mac, using the upstream barcode.png which I converted to PGM:

$ irb -rzbar
ruby-1.9.2-p180 :001 > pp ZBar::Image.from_pgm(File.open('barcode.pgm', 'rb')).process
[#<ZBar::Symbol:0x00000100aade20
  @addon="",
  @data="9876543210128",
...

from ruby-zbar.

lawso017 avatar lawso017 commented on July 17, 2024

Never mind -- in Ruby 1.8 we weren't explicitly reading the file as binary. Can't get away with that in 1.9!

from ruby-zbar.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.