Closed lawso017 closed 13 years ago
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:
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.Zbar.verbosity = 100
, and see if you get anything on stderr.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",
...
Never mind -- in Ruby 1.8 we weren't explicitly reading the file as binary. Can't get away with that in 1.9!
Thanks for a great library. Wer're having trouble transitioning from development (Rails 3.0.4/Ruby 1.8.7 on Snow Leopard) to our production environment (Gentoo Linux 10).
Long story short, we can't get FFI to play nicely with Ruby 1.8.7 on Gentoo 10.
So, we deployed our app server running zbar with Ruby 1.9.2, which does work with FFI on Gentoo. While everything loads and appears to run fine, our production app server is not recognizing any barcodes. No errors, no warnings, just no barcodes. The same images are readily recognized in the dev environment.
Use flags for zbar look like this:
[ebuild N ~] media-gfx/zbar-0.10 USE="imagemagick jpeg threads v4l v4l2 -X -gtk -python -qt4 -xv" 0 kB [1]
please verify that the detected configuration matches your expectations:
X --with-x=disabled pthreads --enable-pthread=yes v4l --enable-video=yes jpeg --with-jpeg=yes Magick++ --with-imagemagick=yes Python --with-python=no GTK+ --with-gtk=no => the GTK+ widget will NOT be built Qt4 --with-qt=no => the Qt4 widget will NOT be built
... any thoughts on possible version sensitivities between 1.8 and 1.9? Our implementation of zbar is almost too simple to troubleshoot:
def find_barcodes @image_file_barcodes = [] @image_files.each{ |jpg| @image_file_barcodes << ZBar::Image.from_jpeg(File.read(jpg)).process} update_status("In progress", "barcoded") end
Thanks for any suggestions...