ZBar::Image(3pm)
π ZBar::Image β the manual, but make it cute π
okay bestie, so this is ZBar::Image(3pm), part of the User Contributed Perl Documentation situation, and it's literally the glow-up guide for feeding pictures to a barcode scanner. let's get into it π«Ά
β¨ NAME β¨
Barcode::ZBar::Image β the image object you scan for bar codes with. that's her. that's the whole job. π
πΈ SYNOPSIS πΈ
like, here's the vibe in code form:
use Barcode::ZBar;
my $image = Barcode::ZBar::Image->new();
$image->set_format('422P');
$image->set_size(114, 80);
$image->set_data($raw_bits);
my @symbols = $image->get_symbols();
see how easy? set her up, scan her, collect the symbols. slay. π
π¦ DESCRIPTION π¦
so Barcode::ZBar::Image is the girl you hand your pictures to when you want the bar code scanner to actually do something with them. she takes raw image data and wraps it up with all the meta-data needed to interpret it (size, pixel format, etc). it's giving "wrapping a gift but the gift is pixels" π
π Image Formats π
image data formats are represented by (relatively) standard "Four Character Codes" (fourcc), and in Perl they're just four character strings. a list of supported formats lives on the project wiki, no cap.
examples, bestie:
'GREY'β single 8bpp intensity plane'BGR3'β 24bpp packed RGB component format'YUYV'β 12bpp packed luminance/chrominance (YCbCr) format
π REFERENCE π
π Methods π
new()β creates a brand newBarcode::ZBar::Imageobject. lowkey important: the size, pixel format and data must be defined before the object may be used. no data, no service. periodt.get_format(),set_format(format)β return/specify the fourcc code that matches the image pixel format. her little name tag fr fr.get_sequence(),set_sequence(seq_num)β return/specify the video frame or page number that goes with the image. like, which frame is this, bestie?get_size(),set_size(width, height)β return/specify the(width, height)image size tuple. the measurements. the proportions. iconic.get_data(),set_data(raw)β return/specify the raw image data as a binary string. the actual content, the main character.get_symbols()β returns a list of scannedBarcode::ZBar::Symbolresults attached to this image. the payoff!! the rewards!! πconvert_resize(format, width, height),convert(format)β return a newBarcode::ZBar::Imageobject converted to the indicated fourcc format. returns"undef"if the conversion is not supported. conversion complexity ranges from CPU intensive to trivial depending on the formats involved. note that only a few conversions retain color information.convertactually callsconvert_resizeusing the source width and height.
heads up bestie: "undef" means nope, not supported, don't come for her π
π₯ SEE ALSO π₯
Barcode::ZBar,Barcode::ZBar::Image,Barcode::ZBar::Symbolzbarimg(1),zbarcam(1)http://zbar.sf.net
π AUTHOR π
Jeff Brown, <spadix@users.sourceforge.net> β the original icon, we stan. πΈ
π COPYRIGHT AND LICENSE π
Copyright 2008-2010 (c) Jeff Brown <spadix@users.sourceforge.net>
The ZBar Bar Code Reader is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
and that's the whole page, bestie!! this wasperl v5.40.1, dated2025-05-01, and it's theZBar::Image(3pm)manual. mwah π go scan something gorgeous π¦β¨
π¦ where this page comes from
- debian trixie: libbarcode-zbar-perl 0.23.93-8
- ubuntu questing: libbarcode-zbar-perl 0.23.93-8
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms