GD::Convert - additional output formats for GD
use GD; use GD::Convert qw(gif=gif_netpbm newFromGif=newFromGif_imagemagick wbmp); # or: require GD::Convert; import GD::Convert; ... $gd->ppm; $gd->xpm; $gd->gif; $gd->wbmp; ... $gd = GD::Image->newFromPpmData(...); $gd = GD::Image->newFromGif(...);
This module provides additional output methods for the GD module: ppm, xpm, wbmp, gif_netpbm and gif_imagemagick, and also additional constructors: newFromPpm, newFromPpmData, newFromGif_netpbm, newFromGifData_netpbm, newFromGif_imagemagick, newFromGifData_imagemagick.
ppm
xpm
wbmp
gif_netpbm
gif_imagemagick
newFromPpm
newFromPpmData
newFromGif_netpbm
newFromGifData_netpbm
newFromGif_imagemagick
newFromGifData_imagemagick
The new methods go into the GD namespace.
GD
For convenience, it is possible to set shorter names for the gif, newFromGif and newFromGifData methods by providing one of the following strings in the import list:
gif
newFromGif
newFromGifData
Use external commands from netpbm to load and create GIF images.
Use external commands from imagemagick to load and create GIF images.
Use any of the above methods to load and create GIF images.
Create wbmp images. Only necessary for GD before version 1.26, but it does not hurt if it is included with newer GD versions.
The new methods and constructors:
Take a GD image and return a string with a PPM file as its content.
Take a GD image and return a string with a XPM file as its content.
Take a GD image and return a string with a GIF file as its content. The conversion will use the ppmtogif binary from netpbm. Make sure that ppmtogif is actually in your PATH. If you specify gif=gif_netpbm in the use line, then you can use the method name gif instead.
ppmtogif
netpbm
PATH
gif=gif_netpbm
use
The gif_netpbm handles the optional parameter -transparencyhack. If set to a true value, a transparent GIF file will be produced. Note that this will not work if the transparent color occurs also as a normal color.
-transparencyhack
This is the same as gif_netpbm, instead it is using the convert program of ImageMagick.
convert
Create a GD image from the named ppm file or filehandle reference. Only raw ppm files (signature P6) are supported.
Create a GD image from the data string containing ppm data. Only raw ppm files are supported.
Create a GD image from the named file or filehandle reference using external netpbm programs.
Create a GD image from the data string using external netpbm programs.
Create a GD image from the named file or filehandle reference using external ImageMagick programs.
Create a GD image from the data string using external ImageMagick programs.
You can set the variable $GD::Convert::DEBUG to a true value to get some information about external commands used while converting.
$GD::Convert::DEBUG
Transparency will get lost in PPM images.
The transparency handling for GIF images is clumsy --- maybe the new --alpha option of ppmtogif should be used.
The size of the created files should be smaller, especially of the XPM output.
IPC::Open3 does not work if running under mod_perl. In this case ($ENV{MOD_PERL} detected) a scheme with temporary files is used. This may be still flaky, better solutions are in the research.
Slaven Rezic <slaven@rezic.de>
Copyright (c) 2001,2003,2008 Slaven Rezic. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
GD, netpbm(1), convert(1).
To install GD::Convert, copy and paste the appropriate command in to your terminal.
cpanm
cpanm GD::Convert
CPAN shell
perl -MCPAN -e shell install GD::Convert
For more information on module installation, please visit the detailed CPAN module installation guide.