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 new Barcode::ZBar::Image object. 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 scanned Barcode::ZBar::Symbol results attached to this image. the payoff!! the rewards!! 🌟
  • convert_resize(format, width, height), convert(format) β€” return a new Barcode::ZBar::Image object 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. convert actually calls convert_resize using the source width and height.
heads up bestie: "undef" means nope, not supported, don't come for her πŸ’€

πŸ”₯ SEE ALSO πŸ”₯


πŸŽ€ AUTHOR πŸŽ€

Jeff Brown, <spadix@users.sourceforge.net> β€” the original icon, we stan. 🌸


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 was perl v5.40.1, dated 2025-05-01, and it's the ZBar::Image(3pm) manual. mwah πŸ’‹ go scan something gorgeous πŸ¦‹βœ¨
πŸ“¦ where this page comes from