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::Pixbuf
with 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
$type
or not available at all. For example thecompression
option 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 thecompression
option. 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 thecompression
option. 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 thequality
option. tEXt:foo
(string)-
A PNG style keyword string. For
$type
"png" in Gtk 2.8 this is passed through astEXt
, with autf8::upgrade
if necessary in Gtk2-Perl 1.221, and moved to before anycompression
option 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::PixbufFormat
for the given$filename
based 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_format
throws an error in Gtk 2.0. Would returningundef
be better? App::MathImage::Gtk2::Ex::GdkPixbufBits::format_matches_filename ($format, $filename)
-
$format
should be aGtk2::Gdk::PixbufFormat
object. Return true if one of its extensions matches$filename
. For example JPEG format matches foo.jpg or foo.jpeg.