Comments (4)
Following these same steps, I get:
> r = z.process
=> [#<ZBar::Symbol:0x007fd63a869c60 @symbology="EAN-13", @data="9788679912077", @addon="", @quality=835, @location=[[819, 28], [463, 29], [130, 29], ...]>]
Are you sure the zbar
gem is loading the right libzbar.so
? Try setting the ZBAR_LIB
environment variable to its full path.
from ruby-zbar.
I'm sure it is loading the right libzbar:
irb(main):007:0> ZBar.ffi_libraries.map{|x|x.instance_variable_get(:@name)}
=> ["/usr/lib64/libzbar.so.0.2.0", "/usr/lib64/libzbar.so.0"]
[user@ip-10-0-0-119 ~]$ ldd `which zbarimg` | grep zbar
libzbar.so.0 => /usr/lib64/libzbar.so.0 (0x00007f625b520000)
If I run convert bigstock-Barcode-18830351.jpg bigstock-Barcode-18830351.pgm
and then use ZBar::Image.from_pgm
, it processes the pgm image and decodes the barcode fine. So there is only a problem with jpegs.
from ruby-zbar.
Almost a year later, I have this same problem. In my case, I'm on CentOS, and rebuilt the rpm from source, applying the patch provided here.
However, running the image directly through the zbarimg
binary DOES work.
@pzb Did you ever resolve this, or just end up converting to PGM?
from ruby-zbar.
It's may be a JPEG quality issue.
I got a .png QR Code image cropped from a scanner generated image, and zbarimg can read it. While when I use imagemagick convert it to .jpg, then zbar failed to read it. Convert it to .pgm, zbar reads it.
Finally, I convert it to .jpg via command: convert crop.png -quality 90 crop.jpg, then zbar can read the jpg file now.
bogon: ~/Downloads/VouchPic ]
stone$ zbarimg crop2.png
QR-Code:01,01,3400182130,00993210,1635.85,20180814,,4A08,
scanned 1 barcode symbols from 1 images in 0.01 seconds
bogon: ~/Downloads/VouchPic ]
stone$ convert crop2.png crop2.jpg
bogon: ~/Downloads/VouchPic ]
stone$ ruby -r zbar -e "p ZBar::Image.from_jpeg(File.binread('crop2.jpg')).process"
[]
bogon: ~/Downloads/VouchPic ]
stone$ convert crop2.png -quality 90 crop2.jpg
bogon: ~/Downloads/VouchPic ]
stone$ ruby -r zbar -e "p ZBar::Image.from_jpeg(File.binread('crop2.jpg')).process"
[#<ZBar::Symbol:0x00007ff6ce11cb10 @symbology="QR-Code", @data="01,01,3400182130,00993210,1635.85,20180814,,4A08,", @addon="", @quality=1, @location=[[20, 11], [17, 200], [211, 203], [212, 13]]>]
bogon: ~/Downloads/VouchPic ]
stone$
from ruby-zbar.
Related Issues (13)
- Ruby 1.9 v 1.8? HOT 2
- JPEG datastream contains no image HOT 24
- LoadError: no library specified HOT 2
- only search for specific symbology? HOT 6
- 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.