PDF::Bu...::Image(3)

πŸ’– PDF::Builder::Resource::XObject::Image β€” bestie edition πŸ’–

okay so this is PDF::Bu...::Image(3), part of the User Contributed Perl Documentation, and she is the base class for external raster image objects. Think of her as the momager for every image you're about to slide into a PDF. πŸ‘‘

She inherits from PDF::Builder::Resource::XObject, so all that good XObject energy is already in the family tree. 🌈


✨ METHODS ✨

🌸 new

$image = PDF::Builder::Resource::XObject::Image->new($pdf, $name)

Returns an image resource object. That's it, that's the whole vibe β€” you hand her a $pdf and a $name, she hands you back an image resource object. slay. πŸŽ€


πŸ¦‹ width

$width = $image->width()

Gets the width of the image object, in points. ✨

okay so listen, this function also has the ability to set the width β€” you give it the new width in points and it's supposed to change it. but it appears that it never worked correctly. 😭 The set capability has been deprecated, and it may be removed soon, unless it turns out to be needed for an <img> tag in column(). So if you're out here using the width() method in some manner to set the image width, please let us know, so they can plan to keep it enabled! 🫢

bestie. if you use this to set width, SPEAK UP. she's literally about to get cut from the group chat and she needs a reason to stay. πŸ’€

πŸ’… height

$height = $image->height()

Gets the height of the image object, in points. πŸ’–

and yeah, same story as width, no cap β€” this function also has the ability to set the height by giving the new height in points, but it appears that it never worked correctly. The set capability has been deprecated, and may be removed soon, unless it's found to be needed for an <img> tag in column(). If you're using the height() method in some manner to set the image height, please let us know, so they can plan to keep it enabled! πŸ™ˆ

fr fr, same PSA as above. don't let her go out sad. πŸ₯Ί

🧚 smask

$image->smask($xobject)

Set the soft-mask image object. soft, gentle, mysterious. it's giving ghosted but in a pretty way. πŸ‘»βœ¨


⭐ mask

$image->mask(@color_range)

$image->mask($xobject)

Set the mask to an image mask XObject, or to an array containing a range of colors to be applied as a color key mask. Two ways in, one iconic method. πŸ‘‘


🌈 colorspace

$image->colorspace($name)

$image->colorspace($array)

Set the color space used by the image. Depending on which color space it is, this will either be just the name of the color space, or it will be an array containing the color space plus any required parameters. 🎨

If you're passing an array, the parameters must already be encoded as PDF objects. The array itself may also be a PDF object β€” and if it's not, one will be created for you. no stress, she's got you. 🫢


πŸ’œ bits_per_component

$image->bits_per_component($integer)

Set the number of bits used to represent each color component. tiny numbers, huge responsibility. ✨


and that's the whole page, bestie β€” every method, every deprecation, every "please let us know", all of it. periodt. πŸ’…

this page came to you courtesy of perl v5.42.0, dated 2026-01-17, and it's filed under PDF::Bu...::Image(3). mwah, take care of her, she's been deprecated enough today. πŸŽ€πŸ’–πŸ¦‹

πŸ“¦ where this page comes from