NAME
App::MathImage::Gtk2::Ex::GdkPixbufBits -- misc pixbuf helpers
SYNOPSIS
use App::MathImage::Gtk2::Ex::GdkPixbufBits;
FUNCTIONS
App::MathImage::Gtk2::Ex::GdkPixbufBits::save ($pixbuf, $filename, $type, key => value, ...)@args = App::MathImage::Gtk2::Ex::GdkPixbufBits::save_options ($type, key => value, ...)-
save()saves aGtk2::Gdk::Pixbufwith options adapted to what the Gtk in use supports.save_options()adapts options and returns them.The idea is to pass a full set of options which are automatically reduced if not applicable to the
$typeor not available at all. For example thecompressionoption must be set different ways for PNG or for TIFF. The two separate compression options here are used according to the$type.zlib_compression(integer 0 to 9 or -1)-
A Zlib style compression level. For
$type"png" in Gtk 2.8 this becomes thecompressionoption. tiff_compression_type(integer or names "none", "huffman", "lzw", "jpeg" or "deflate")-
A TIFF compression method. For
$type"tiff" in Gtk 2.20 this becomes thecompressionoption. String names "deflate" etc are converted to the corresponding integer value. quality_percent(0 to 100)-
An image quality percentage, for lossy formats such as JPEG. For
$type"jpeg" this becomes thequalityoption. tEXt:foo(string)-
A PNG style keyword string. For
$type"png" in Gtk 2.8 this is passed through astEXt, with autf8::upgradeif necessary in Gtk2-Perl 1.221, and moved to before anycompressionoption as a workaround for a Gtk bug.
For example
App::MathImage::Gtk2::Ex::GdkPixbufBits::save ($pixbuf, # Gtk2::Gdk::Pixbuf object $user_filename, # eg. string "/tmp/foo" $user_type, # eg. string "png" zlib_compression => 9, quality_percent => 100, tiff_compression_type => "deflate", tEXt:Author => "Yorick"); $format = App::MathImage::Gtk2::Ex::GdkPixbufBits::filename_to_format ($filename)-
Return the
Gtk2::Gdk::PixbufFormatfor the given$filenamebased on its extension. For example foo.png is PNG format. If the filename is not recognised then returnundef.PixbufFormat is new in Gtk 2.2. Currently
filename_to_formatthrows an error in Gtk 2.0. Would returningundefbe better? App::MathImage::Gtk2::Ex::GdkPixbufBits::format_matches_filename ($format, $filename)-
$formatshould be aGtk2::Gdk::PixbufFormatobject. Return true if one of its extensions matches$filename. For example JPEG format matches foo.jpg or foo.jpeg.