Comments (2)
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:
- Call
File.read(jpg, :binmode => true)
, instead of justFile.read(jpg)
. By default, Ruby will treat it as text, and possibly garbling the bits as it changes encodings. - Call
Zbar.verbosity = 100
, and see if you get anything on stderr. - 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.
- 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.
- 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.
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)
- JPEG datastream contains no image HOT 24
- LoadError: no library specified HOT 2
- only search for specific symbology? HOT 6
- Cannot process jpeg image HOT 4
- Implementing HOT 1
- Decoding PNG images HOT 15
- Q:Heroku Zbar Didn't find libzbar on your system (LoadError) HOT 23
- Wouldn't read a valid PGM file HOT 2
- Can't read code with some noise. iOS app using zbar scans it fine. HOT 3
- ruby-zbar with EPEL zbar doesn't work correctly on CentOS7. HOT 1
- from_jpeg - Segmentation fault at 0x0000000000000000 HOT 1
- ZBAR ON MAC BROKEN? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ruby-zbar.