gd
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 94
GD::Map 1.00
GD::Map is Perl extension for creating geographic map files with GD. more>>
GD::Map is Perl extension for creating geographic map files with GD.
SYNOPSIS
use GD::Map;
my $m = GD::Map:new(
basemap_path => "[required]",
output_path => "[required]",
verbose => 1,
);
$m->set_basemap("northamerica");
$m->add_object(id => "route", type => "line", color => "255,0,0");
$m->add_data(
id => "route",
start_long => 123.1,
end_long => 124.7,
start_lat => 49.3,
end_lat => 37.5,
);
$m->draw();
my $filename = "$m->{filename}.png";
my $w = $m->{map_width};
my $h = $m->{map_height};
ABSTRACT
Perl extension for creating geographic map files with GD
<<lessSYNOPSIS
use GD::Map;
my $m = GD::Map:new(
basemap_path => "[required]",
output_path => "[required]",
verbose => 1,
);
$m->set_basemap("northamerica");
$m->add_object(id => "route", type => "line", color => "255,0,0");
$m->add_data(
id => "route",
start_long => 123.1,
end_long => 124.7,
start_lat => 49.3,
end_lat => 37.5,
);
$m->draw();
my $filename = "$m->{filename}.png";
my $w = $m->{map_width};
my $h = $m->{map_height};
ABSTRACT
Perl extension for creating geographic map files with GD
Download (0.008MB)
Added: 2006-10-27 License: Perl Artistic License Price:
1092 downloads
GD::Text 0.86
GD::Text is a Perl module with text utilities for use with GD. more>>
GD::Text is a Perl module with text utilities for use with GD.
SYNOPSIS
use GD;
use GD::Text;
my $gd_text = GD::Text->new() or die GD::Text::error();
$gd_text->set_font(funny.ttf, 12) or die $gd_text->error;
$gd_text->set_font(gdTinyFont);
$gd_text->set_font(GD::Font::Tiny);
...
$gd_text->set_text($string);
my ($w, $h) = $gd_text->get(width, height);
if ($gd_text->is_ttf)
{
...
}
Or alternatively
my $gd_text = GD::Text->new(
text => Some text,
font => funny.ttf,
ptsize => 14,
);
This module provides a font-independent way of dealing with text in GD, for use with the GD::Text::* modules and GD::Graph.
<<lessSYNOPSIS
use GD;
use GD::Text;
my $gd_text = GD::Text->new() or die GD::Text::error();
$gd_text->set_font(funny.ttf, 12) or die $gd_text->error;
$gd_text->set_font(gdTinyFont);
$gd_text->set_font(GD::Font::Tiny);
...
$gd_text->set_text($string);
my ($w, $h) = $gd_text->get(width, height);
if ($gd_text->is_ttf)
{
...
}
Or alternatively
my $gd_text = GD::Text->new(
text => Some text,
font => funny.ttf,
ptsize => 14,
);
This module provides a font-independent way of dealing with text in GD, for use with the GD::Text::* modules and GD::Graph.
Download (0.063MB)
Added: 2006-10-02 License: Perl Artistic License Price:
648 downloads
GD::SGF 0.9.7
GD::SGF is a Perl module to simplify SGF game rendering using GD::Image. more>>
GD::SGF is a Perl module to simplify SGF game rendering using GD::Image.
SYNOPSIS
use Games::Go::SGF2misc::GD;
my $image = new Games::Go::SGF2misc::GD(imagesize => 256,
boardsize => 19,
antialias => 1 );
$image->gobanColor(127,127,127);
$image->drawGoban();
$image->placeStone(b,cd);
$image->placeStone(w,[4,2]);
$image->placeStone(b,db);
$image->placeStone(w,dc);
$image->placeStone(b,cc);
$image->placeStone(w,eb);
$image->placeStone(b,cb);
$image->addCircle(cb,1);
$image->save($filename);
Games::Go::SGF2misc::GD is a Perl Wrapper for the GD.pm module. It simplifies the process of rendering an image from an SGF file. It is however still a primitive interface, in that it does not contain any internal intellegence about how to process an SGF file, this is merely designed to be used in conjunction with an SGF reader such as Games::Go::SGF2misc or Games::Go::SGF.
<<lessSYNOPSIS
use Games::Go::SGF2misc::GD;
my $image = new Games::Go::SGF2misc::GD(imagesize => 256,
boardsize => 19,
antialias => 1 );
$image->gobanColor(127,127,127);
$image->drawGoban();
$image->placeStone(b,cd);
$image->placeStone(w,[4,2]);
$image->placeStone(b,db);
$image->placeStone(w,dc);
$image->placeStone(b,cc);
$image->placeStone(w,eb);
$image->placeStone(b,cb);
$image->addCircle(cb,1);
$image->save($filename);
Games::Go::SGF2misc::GD is a Perl Wrapper for the GD.pm module. It simplifies the process of rendering an image from an SGF file. It is however still a primitive interface, in that it does not contain any internal intellegence about how to process an SGF file, this is merely designed to be used in conjunction with an SGF reader such as Games::Go::SGF2misc or Games::Go::SGF.
Download (0.10MB)
Added: 2007-07-04 License: Perl Artistic License Price:
843 downloads
GD::XYScale 1.2
GD::XYScale can draw a 2D X-Y scale and use it. more>>
GD::XYScale can draw a 2D X-Y scale and use it.
SYNOPSIS
use GD;
use GD::XYScale;
$image = GD::Image->new($width,$height);
$white = $image->colorAllocate(255,255,255);
$black = $image->colorAllocate(0,0,0);
$blue = $image->colorAllocate(0,0,255);
# continue using your GD image object.
$scale = GD::XYScale->new($image);
# put the origin at x=50, y=80 and zoom-out with .5
$scale->origin(50,80,.5);
$scale->draw(1.5,$black);
$scale->name(up,
x scale,
y scale,
$blue,
gdSmallFont,
show_zoom,
$blue);
# draw some geomethric objects, curves,
# plot something... etc...
This module adds a 2D scale to your GD image. It needs a GD::Image object to work.
First versions were modifying GD::Image namespace and I then realized that this is not a good thing. In this version and future versions, the module will use its own namespace, so check your codes if you tried this module before version 1.2
<<lessSYNOPSIS
use GD;
use GD::XYScale;
$image = GD::Image->new($width,$height);
$white = $image->colorAllocate(255,255,255);
$black = $image->colorAllocate(0,0,0);
$blue = $image->colorAllocate(0,0,255);
# continue using your GD image object.
$scale = GD::XYScale->new($image);
# put the origin at x=50, y=80 and zoom-out with .5
$scale->origin(50,80,.5);
$scale->draw(1.5,$black);
$scale->name(up,
x scale,
y scale,
$blue,
gdSmallFont,
show_zoom,
$blue);
# draw some geomethric objects, curves,
# plot something... etc...
This module adds a 2D scale to your GD image. It needs a GD::Image object to work.
First versions were modifying GD::Image namespace and I then realized that this is not a good thing. In this version and future versions, the module will use its own namespace, so check your codes if you tried this module before version 1.2
Download (0.008MB)
Added: 2006-08-01 License: Perl Artistic License Price:
1179 downloads
GD-Octave 0.0.3
GD-Octave is a GD library API for Octave. more>>
GD-Octave is a library glue for exporting GD library functions into octave. It features string and text rendering to the PNG, JPEG, GIF, and WBMP image formats. Line, Point, Arc, Polygon, and Fill are supported as primitives.
TODO:
Make up a class-like wrapper.
Keep track of pointers, and make sure you dont crash the system as and when you like to.
Map types:
GD type Octave Type
int * Matrix [1row, multiple cols]
gdPointPtr Matrix [n rows, 2 cols]
char * string
gdImagePtr long int
FILE * octave_stream
gdIOCtxPtr long int
void * long int
<<lessTODO:
Make up a class-like wrapper.
Keep track of pointers, and make sure you dont crash the system as and when you like to.
Map types:
GD type Octave Type
int * Matrix [1row, multiple cols]
gdPointPtr Matrix [n rows, 2 cols]
char * string
gdImagePtr long int
FILE * octave_stream
gdIOCtxPtr long int
void * long int
Download (0.058MB)
Added: 2005-10-04 License: GPL (GNU General Public License) Price:
1480 downloads
GD::Barcode 1.15
GD::Barcode is a Perl module to create barcode image with GD. more>>
SYNOPSIS
ex. CGI
use GD::Barcode::UPCE;
binmode(STDOUT);
print "Content-Type: image/pngnn";
print GD::Barcode->new(EAN13, 123456789012)->plot->png;
with Error Check
my $oGdBar = GD::Barcode->new(EAN13, 12345678901);
die $GD::Barcode::errStr unless($oGdBar); #Invalid Length
$oGdBar->plot->png;
GD::Barcode is a subclass of GD and allows you to create barcode image with GD. This module based on "Generate Barcode Ver 1.02 By Shisei Hanai 97/08/22".
From 1.14, you can use this module even if no GD (except plot method).
new
$oGdBar = GD::Barcode::UPCE->new($sType, $sTxt);
Constructor. Creates a GD::Barcode::$sType object for $sTxt.
plot()
$oGd = $oGdBar->plot([Height => $iHeight, NoText => 0 | 1]);
creates GD object with barcode image for the $sTxt specified at new method. $iHeight is height of the image. If NoText is 1, the image has no text image of $sTxt.
ex.
my $oGdB = GD::Barcode->new(EAN13, 123456789012);
my $oGD = $oGdB->plot(NoText=>1, Height => 20);
# $sGD is a GD image with Height=>20 pixels, with no text.
barcode()
$sPtn = $oGdBar->barcode();
returns a barcode pattern in string with 1 and 0. 1 means black, 0 means white.
ex.
my $oGdB = GD::Barcode->new(UPCE, 123456789012);
my $sPtn = $oGdB->barcode();
# $sPtn = ;
$errStr
$GD::Barcode::errStr
has error message.
$text
$oGdBar->{$text}
has barcode text based on $sTxt specified in new method.
Download (0.87MB)
Added: 2007-04-24 License: Perl Artistic License Price:
925 downloads
GD::Simple 2.35
GD::Simple module is a simplified interface to GD library. more>>
GD::Simple module is a simplified interface to GD library.
SYNOPSIS
use GD::Simple;
# create a new image
$img = GD::Simple->new(400,250);
# draw a red rectangle with blue borders
$img->bgcolor(red);
$img->fgcolor(blue);
$img->rectangle(10,10,50,50);
# draw an empty rectangle with green borders
$img->bgcolor(undef);
$img->fgcolor(green);
$img->rectangle(30,30,100,100);
# move to (80,80) and draw a green line to (100,190)
$img->moveTo(80,80);
$img->lineTo(100,190);
# draw a solid orange ellipse
$img->moveTo(110,100);
$img->bgcolor(orange);
$img->fgcolor(orange);
$img->ellipse(40,40);
# draw a black filled arc
$img->moveTo(150,150);
$img->fgcolor(black);
$img->arc(50,50,0,100,gdNoFill|gdEdged);
# draw a string at (10,180) using the default
# built-in font
$img->moveTo(10,180);
$img->string(This is very simple);
# draw a string at (280,210) using 20 point
# times italic, angled upward 90 degrees
$img->moveTo(280,210);
$img->font(Times:italic);
$img->fontsize(20);
$img->angle(-90);
$img->string(This is very fancy);
# some turtle graphics
$img->moveTo(300,100);
$img->penSize(3,3);
$img->angle(0);
$img->line(20); # 20 pixels going to the right
$img->turn(30); # set turning angle to 30 degrees
$img->line(20); # 20 pixel line
$img->line(20);
$img->line(20);
$img->turn(-90); # set turning angle to -90 degrees
$img->line(50); # 50 pixel line
# draw a cyan polygon edged in blue
my $poly = new GD::Polygon;
$poly->addPt(150,100);
$poly->addPt(199,199);
$poly->addPt(100,199);
$img->bgcolor(cyan);
$img->fgcolor(blue);
$img->penSize(1,1);
$img->polygon($poly);
# convert into png data
print $img->png;
GD::Simple is a subclass of the GD library that shortens many of the long GD method calls by storing information about the pen color, size and position in the GD object itself. It also adds a small number of "turtle graphics" style calls for those who prefer to work in polar coordinates. In addition, the library allows you to use symbolic names for colors, such as "chartreuse", and will manage the colors for you.
The Pen
GD::Simple maintains a "pen" whose settings are used for line- and shape-drawing operations. The pen has the following properties:
fgcolor
The pen foreground color is the color of lines and the borders of filled and unfilled shapes.
bgcolor
The pen background color is the color of the contents of filled shapes.
pensize
The pen size is the width of the pen. Larger sizes draw thicker lines.
position
The pen position is its current position on the canvas in (X,Y) coordinates.
angle
When drawing in turtle mode, the pen angle determines the current direction of lines of relative length.
turn
When drawing in turtle mode, the turn determines the clockwise or counterclockwise angle that the pen will turn before drawing the next line.
font
The font to use when drawing text. Both built-in bitmapped fonts and TrueType fonts are supported.
fontsize
The size of the font to use when drawing with TrueType fonts.
One sets the position and properties of the pen and then draws. As the drawing progresses, the position of the pen is updated.
Methods
GD::Simple introduces a number of new methods, a few of which have the same name as GD::Image methods, and hence change their behavior. In addition to these new methods, GD::Simple objects support all of the GD::Image methods. If you make a method call that isnt directly supported by GD::Simple, it refers the request to the underlying GD::Image object. Hence one can load a JPEG image into GD::Simple and declare it to be TrueColor by using this call, which is effectively inherited from GD::Image:
my $img = GD::Simple->newFromJpeg(./myimage.jpg,1);
The rest of this section describes GD::Simple-specific methods.
$img->moveTo($x,$y)
This call changes the position of the pen without drawing. It moves the pen to position ($x,$y) on the drawing canvas.
$img->move($dx,$dy)
$img->move($dr)
This call changes the position of the pen without drawing. When called with two arguments it moves the pen $dx pixels to the right and $dy pixels downward. When called with one argument it moves the pen $dr pixels along the vector described by the current pen angle.
$img->lineTo($x,$y)
The lineTo() call simultaneously draws and moves the pen. It draws a line from the current pen position to the position defined by ($x,$y) using the current pen size and color. After drawing, the position of the pen is updated to the new position.
$img->line($dx,$dy)
$img->line($dr)
The line() call simultaneously draws and moves the pen. When called with two arguments it draws a line from the current position of the pen to the position $dx pixels to the right and $dy pixels down. When called with one argument, it draws a line $dr pixels long along the angle defined by the current pen angle.
$img->clear
This method clears the canvas by painting over it with the current background color.
$img->rectangle($x1,$y1,$x2,$y2)
This method draws the rectangle defined by corners ($x1,$y1), ($x2,$y2). The rectangles edges are drawn in the foreground color and its contents are filled with the background color. To draw a solid rectangle set bgcolor equal to fgcolor. To draw an unfilled rectangle (transparent inside), set bgcolor to undef.
$img->ellipse($width,$height)
This method draws the ellipse centered at the current location with width $width and height $height. The ellipses border is drawn in the foreground color and its contents are filled with the background color. To draw a solid ellipse set bgcolor equal to fgcolor. To draw an unfilled ellipse (transparent inside), set bgcolor to undef.
$img->arc($cx,$cy,$width,$height,$start,$end [,$style])
This method draws filled and unfilled arcs. See GD for a description of the arguments. To draw a solid arc (such as a pie wedge) set bgcolor equal to fgcolor. To draw an unfilled arc, set bgcolor to undef.
$img->polygon($poly)
This method draws filled and unfilled polygon using the current settings of fgcolor for the polygon border and bgcolor for the polygon fill color. See GD for a description of creating polygons. To draw a solid polygon set bgcolor equal to fgcolor. To draw an unfilled polygon, set bgcolor to undef.
$img->polyline($poly)
This method draws polygons without closing the first and last vertices (similar to GD::Image->unclosedPolygon()). It uses the fgcolor to draw the line.
$img->string($string)
This method draws the indicated string starting at the current position of the pen. The pen is moved to the end of the drawn string. Depending on the font selected with the font() method, this will use either a bitmapped GD font or a TrueType font. The angle of the pen will be consulted when drawing the text. For TrueType fonts, any angle is accepted. For GD bitmapped fonts, the angle can be either 0 (draw horizontal) or -90 (draw upwards).
For consistency between the TrueType and GD font behavior, the string is always drawn so that the current position of the pen corresponds to the bottom left of the first character of the text. This is different from the GD behavior, in which the first character of bitmapped fonts hangs down from the pen point.
This method returns a polygon indicating the bounding box of the rendered text. If an error occurred (such as invalid font specification) it returns undef and an error message in $@.
$metrics = $img->fontMetrics
($metrics,$width,$height) = GD::Simple->fontMetrics($font,$fontsize,$string)
This method returns information about the current font, most commonly a TrueType font. It can be invoked as an instance method (on a previously-created GD::Simple object) or as a class method (on the GD::Simple class).
When called as an instance method, fontMetrics() takes no arguments and returns a single hash reference containing the metrics that describe the currently selected font and size. The hash reference contains the following information:
xheight the base height of the font from the bottom to the top of
a lowercase m
ascent the length of the upper stem of the lowercase d
descent the length of the lower step of the lowercase j
lineheight the distance from the bottom of the j to the top of
the d
leading the distance between two adjacent lines
($delta_x,$delta_y)= $img->stringBounds($string)
This method indicates the X and Y offsets (which may be negative) that will occur when the given string is drawn using the current font, fontsize and angle. When the string is drawn horizontally, it gives the width and height of the strings bounding box.
$delta_x = $img->stringWidth($string)
This method indicates the width of the string given the current font, fontsize and angle. It is the same as ($img->stringBounds($string))[0]
($x,$y) = $img->curPos
Return the current position of the pen. Set the current position using moveTo().
$font = $img->font([$newfont] [,$newsize])
Get or set the current font. Fonts can be GD::Font objects, TrueType font file paths, or fontconfig font patterns like "Times:italic" (see fontconfig). The latter feature requires that you have the fontconfig library installed and are using libgd version 2.0.33 or higher.
As a shortcut, you may pass two arguments to set the font and the fontsize simultaneously. The fontsize is only valid when drawing with TrueType fonts.
$size = $img->fontsize([$newfontsize])
Get or set the current font size. This is only valid for TrueType fonts.
$size = $img->penSize([$newpensize])
Get or set the current pen width for use during line drawing operations.
$angle = $img->angle([$newangle])
Set the current angle for use when calling line() or move() with a single argument.
Here is an example of using turn() and angle() together to draw an octagon. The first line drawn is the downward-slanting top right edge. The last line drawn is the horizontal top of the octagon.
$img->moveTo(200,50);
$img->angle(0);
$img->turn(360/8);
for (1..8) { $img->line(50) }
$angle = $img->turn([$newangle])
Get or set the current angle to turn prior to drawing lines. This value is only used when calling line() or move() with a single argument. The turning angle will be applied to each call to line() or move() just before the actual drawing occurs.
Angles are in degrees. Positive values turn the angle clockwise.
$color = $img->fgcolor([$newcolor])
Get or set the pens foreground color. The current pen color can be set by (1) using an (r,g,b) triple; (2) using a previously-allocated color from the GD palette; or (3) by using a symbolic color name such as "chartreuse." The list of color names can be obtained using color_names().
$color = $img->bgcolor([$newcolor])
Get or set the pens background color. The current pen color can be set by (1) using an (r,g,b) triple; (2) using a previously-allocated color from the GD palette; or (3) by using a symbolic color name such as "chartreuse." The list of color names can be obtained using color_names().
$index = $img->translate_color(@args)
Translates a color into a GD palette or TrueColor index. You may pass either an (r,g,b) triple or a symbolic color name. If you pass a previously-allocated index, the method will return it unchanged.
$index = $img->alphaColor(@args,$alpha)
Creates an alpha color. You may pass either an (r,g,b) triple or a symbolic color name, followed by an integer indicating its opacity. The opacity value ranges from 0 (fully opaque) to 127 (fully transparent).
@names = GD::Simple->color_names
$translate_table = GD::Simple->color_names
Called in a list context, color_names() returns the list of symbolic color names recognized by this module. Called in a scalar context, the method returns a hash reference in which the keys are the color names and the values are array references containing [r,g,b] triples.
$gd = $img->gd
Return the internal GD::Image object. Usually you will not need to call this since all GD methods are automatically referred to this object.
($red,$green,$blue) = GD::Simple->HSVtoRGB($hue,$saturation,$value)
Convert a Hue/Saturation/Value (HSV) color into an RGB triple. The hue, saturation and value are integers from 0 to 255.
($hue,$saturation,$value) = GD::Simple->RGBtoHSV($hue,$saturation,$value)
Convert a Red/Green/Blue (RGB) value into a Hue/Saturation/Value (HSV) triple. The hue, saturation and value are integers from 0 to 255.
COLORS
This script will create an image showing all the symbolic colors.
#!/usr/bin/perl
use strict;
use GD::Simple;
my @color_names = GD::Simple->color_names;
my $cols = int(sqrt(@color_names));
my $rows = int(@color_names/$cols)+1;
my $cell_width = 100;
my $cell_height = 50;
my $legend_height = 16;
my $width = $cols * $cell_width;
my $height = $rows * $cell_height;
my $img = GD::Simple->new($width,$height);
$img->font(gdSmallFont);
for (my $c=0; $cfgcolor($color);
$img->rectangle(@topleft,@botright);
$img->moveTo($topleft[0]+2,$botright[1]+$legend_height-2);
$img->fgcolor(black);
$img->string($color);
}
}
print $img->png;
<<lessSYNOPSIS
use GD::Simple;
# create a new image
$img = GD::Simple->new(400,250);
# draw a red rectangle with blue borders
$img->bgcolor(red);
$img->fgcolor(blue);
$img->rectangle(10,10,50,50);
# draw an empty rectangle with green borders
$img->bgcolor(undef);
$img->fgcolor(green);
$img->rectangle(30,30,100,100);
# move to (80,80) and draw a green line to (100,190)
$img->moveTo(80,80);
$img->lineTo(100,190);
# draw a solid orange ellipse
$img->moveTo(110,100);
$img->bgcolor(orange);
$img->fgcolor(orange);
$img->ellipse(40,40);
# draw a black filled arc
$img->moveTo(150,150);
$img->fgcolor(black);
$img->arc(50,50,0,100,gdNoFill|gdEdged);
# draw a string at (10,180) using the default
# built-in font
$img->moveTo(10,180);
$img->string(This is very simple);
# draw a string at (280,210) using 20 point
# times italic, angled upward 90 degrees
$img->moveTo(280,210);
$img->font(Times:italic);
$img->fontsize(20);
$img->angle(-90);
$img->string(This is very fancy);
# some turtle graphics
$img->moveTo(300,100);
$img->penSize(3,3);
$img->angle(0);
$img->line(20); # 20 pixels going to the right
$img->turn(30); # set turning angle to 30 degrees
$img->line(20); # 20 pixel line
$img->line(20);
$img->line(20);
$img->turn(-90); # set turning angle to -90 degrees
$img->line(50); # 50 pixel line
# draw a cyan polygon edged in blue
my $poly = new GD::Polygon;
$poly->addPt(150,100);
$poly->addPt(199,199);
$poly->addPt(100,199);
$img->bgcolor(cyan);
$img->fgcolor(blue);
$img->penSize(1,1);
$img->polygon($poly);
# convert into png data
print $img->png;
GD::Simple is a subclass of the GD library that shortens many of the long GD method calls by storing information about the pen color, size and position in the GD object itself. It also adds a small number of "turtle graphics" style calls for those who prefer to work in polar coordinates. In addition, the library allows you to use symbolic names for colors, such as "chartreuse", and will manage the colors for you.
The Pen
GD::Simple maintains a "pen" whose settings are used for line- and shape-drawing operations. The pen has the following properties:
fgcolor
The pen foreground color is the color of lines and the borders of filled and unfilled shapes.
bgcolor
The pen background color is the color of the contents of filled shapes.
pensize
The pen size is the width of the pen. Larger sizes draw thicker lines.
position
The pen position is its current position on the canvas in (X,Y) coordinates.
angle
When drawing in turtle mode, the pen angle determines the current direction of lines of relative length.
turn
When drawing in turtle mode, the turn determines the clockwise or counterclockwise angle that the pen will turn before drawing the next line.
font
The font to use when drawing text. Both built-in bitmapped fonts and TrueType fonts are supported.
fontsize
The size of the font to use when drawing with TrueType fonts.
One sets the position and properties of the pen and then draws. As the drawing progresses, the position of the pen is updated.
Methods
GD::Simple introduces a number of new methods, a few of which have the same name as GD::Image methods, and hence change their behavior. In addition to these new methods, GD::Simple objects support all of the GD::Image methods. If you make a method call that isnt directly supported by GD::Simple, it refers the request to the underlying GD::Image object. Hence one can load a JPEG image into GD::Simple and declare it to be TrueColor by using this call, which is effectively inherited from GD::Image:
my $img = GD::Simple->newFromJpeg(./myimage.jpg,1);
The rest of this section describes GD::Simple-specific methods.
$img->moveTo($x,$y)
This call changes the position of the pen without drawing. It moves the pen to position ($x,$y) on the drawing canvas.
$img->move($dx,$dy)
$img->move($dr)
This call changes the position of the pen without drawing. When called with two arguments it moves the pen $dx pixels to the right and $dy pixels downward. When called with one argument it moves the pen $dr pixels along the vector described by the current pen angle.
$img->lineTo($x,$y)
The lineTo() call simultaneously draws and moves the pen. It draws a line from the current pen position to the position defined by ($x,$y) using the current pen size and color. After drawing, the position of the pen is updated to the new position.
$img->line($dx,$dy)
$img->line($dr)
The line() call simultaneously draws and moves the pen. When called with two arguments it draws a line from the current position of the pen to the position $dx pixels to the right and $dy pixels down. When called with one argument, it draws a line $dr pixels long along the angle defined by the current pen angle.
$img->clear
This method clears the canvas by painting over it with the current background color.
$img->rectangle($x1,$y1,$x2,$y2)
This method draws the rectangle defined by corners ($x1,$y1), ($x2,$y2). The rectangles edges are drawn in the foreground color and its contents are filled with the background color. To draw a solid rectangle set bgcolor equal to fgcolor. To draw an unfilled rectangle (transparent inside), set bgcolor to undef.
$img->ellipse($width,$height)
This method draws the ellipse centered at the current location with width $width and height $height. The ellipses border is drawn in the foreground color and its contents are filled with the background color. To draw a solid ellipse set bgcolor equal to fgcolor. To draw an unfilled ellipse (transparent inside), set bgcolor to undef.
$img->arc($cx,$cy,$width,$height,$start,$end [,$style])
This method draws filled and unfilled arcs. See GD for a description of the arguments. To draw a solid arc (such as a pie wedge) set bgcolor equal to fgcolor. To draw an unfilled arc, set bgcolor to undef.
$img->polygon($poly)
This method draws filled and unfilled polygon using the current settings of fgcolor for the polygon border and bgcolor for the polygon fill color. See GD for a description of creating polygons. To draw a solid polygon set bgcolor equal to fgcolor. To draw an unfilled polygon, set bgcolor to undef.
$img->polyline($poly)
This method draws polygons without closing the first and last vertices (similar to GD::Image->unclosedPolygon()). It uses the fgcolor to draw the line.
$img->string($string)
This method draws the indicated string starting at the current position of the pen. The pen is moved to the end of the drawn string. Depending on the font selected with the font() method, this will use either a bitmapped GD font or a TrueType font. The angle of the pen will be consulted when drawing the text. For TrueType fonts, any angle is accepted. For GD bitmapped fonts, the angle can be either 0 (draw horizontal) or -90 (draw upwards).
For consistency between the TrueType and GD font behavior, the string is always drawn so that the current position of the pen corresponds to the bottom left of the first character of the text. This is different from the GD behavior, in which the first character of bitmapped fonts hangs down from the pen point.
This method returns a polygon indicating the bounding box of the rendered text. If an error occurred (such as invalid font specification) it returns undef and an error message in $@.
$metrics = $img->fontMetrics
($metrics,$width,$height) = GD::Simple->fontMetrics($font,$fontsize,$string)
This method returns information about the current font, most commonly a TrueType font. It can be invoked as an instance method (on a previously-created GD::Simple object) or as a class method (on the GD::Simple class).
When called as an instance method, fontMetrics() takes no arguments and returns a single hash reference containing the metrics that describe the currently selected font and size. The hash reference contains the following information:
xheight the base height of the font from the bottom to the top of
a lowercase m
ascent the length of the upper stem of the lowercase d
descent the length of the lower step of the lowercase j
lineheight the distance from the bottom of the j to the top of
the d
leading the distance between two adjacent lines
($delta_x,$delta_y)= $img->stringBounds($string)
This method indicates the X and Y offsets (which may be negative) that will occur when the given string is drawn using the current font, fontsize and angle. When the string is drawn horizontally, it gives the width and height of the strings bounding box.
$delta_x = $img->stringWidth($string)
This method indicates the width of the string given the current font, fontsize and angle. It is the same as ($img->stringBounds($string))[0]
($x,$y) = $img->curPos
Return the current position of the pen. Set the current position using moveTo().
$font = $img->font([$newfont] [,$newsize])
Get or set the current font. Fonts can be GD::Font objects, TrueType font file paths, or fontconfig font patterns like "Times:italic" (see fontconfig). The latter feature requires that you have the fontconfig library installed and are using libgd version 2.0.33 or higher.
As a shortcut, you may pass two arguments to set the font and the fontsize simultaneously. The fontsize is only valid when drawing with TrueType fonts.
$size = $img->fontsize([$newfontsize])
Get or set the current font size. This is only valid for TrueType fonts.
$size = $img->penSize([$newpensize])
Get or set the current pen width for use during line drawing operations.
$angle = $img->angle([$newangle])
Set the current angle for use when calling line() or move() with a single argument.
Here is an example of using turn() and angle() together to draw an octagon. The first line drawn is the downward-slanting top right edge. The last line drawn is the horizontal top of the octagon.
$img->moveTo(200,50);
$img->angle(0);
$img->turn(360/8);
for (1..8) { $img->line(50) }
$angle = $img->turn([$newangle])
Get or set the current angle to turn prior to drawing lines. This value is only used when calling line() or move() with a single argument. The turning angle will be applied to each call to line() or move() just before the actual drawing occurs.
Angles are in degrees. Positive values turn the angle clockwise.
$color = $img->fgcolor([$newcolor])
Get or set the pens foreground color. The current pen color can be set by (1) using an (r,g,b) triple; (2) using a previously-allocated color from the GD palette; or (3) by using a symbolic color name such as "chartreuse." The list of color names can be obtained using color_names().
$color = $img->bgcolor([$newcolor])
Get or set the pens background color. The current pen color can be set by (1) using an (r,g,b) triple; (2) using a previously-allocated color from the GD palette; or (3) by using a symbolic color name such as "chartreuse." The list of color names can be obtained using color_names().
$index = $img->translate_color(@args)
Translates a color into a GD palette or TrueColor index. You may pass either an (r,g,b) triple or a symbolic color name. If you pass a previously-allocated index, the method will return it unchanged.
$index = $img->alphaColor(@args,$alpha)
Creates an alpha color. You may pass either an (r,g,b) triple or a symbolic color name, followed by an integer indicating its opacity. The opacity value ranges from 0 (fully opaque) to 127 (fully transparent).
@names = GD::Simple->color_names
$translate_table = GD::Simple->color_names
Called in a list context, color_names() returns the list of symbolic color names recognized by this module. Called in a scalar context, the method returns a hash reference in which the keys are the color names and the values are array references containing [r,g,b] triples.
$gd = $img->gd
Return the internal GD::Image object. Usually you will not need to call this since all GD methods are automatically referred to this object.
($red,$green,$blue) = GD::Simple->HSVtoRGB($hue,$saturation,$value)
Convert a Hue/Saturation/Value (HSV) color into an RGB triple. The hue, saturation and value are integers from 0 to 255.
($hue,$saturation,$value) = GD::Simple->RGBtoHSV($hue,$saturation,$value)
Convert a Red/Green/Blue (RGB) value into a Hue/Saturation/Value (HSV) triple. The hue, saturation and value are integers from 0 to 255.
COLORS
This script will create an image showing all the symbolic colors.
#!/usr/bin/perl
use strict;
use GD::Simple;
my @color_names = GD::Simple->color_names;
my $cols = int(sqrt(@color_names));
my $rows = int(@color_names/$cols)+1;
my $cell_width = 100;
my $cell_height = 50;
my $legend_height = 16;
my $width = $cols * $cell_width;
my $height = $rows * $cell_height;
my $img = GD::Simple->new($width,$height);
$img->font(gdSmallFont);
for (my $c=0; $cfgcolor($color);
$img->rectangle(@topleft,@botright);
$img->moveTo($topleft[0]+2,$botright[1]+$legend_height-2);
$img->fgcolor(black);
$img->string($color);
}
}
print $img->png;
Download (0.25MB)
Added: 2007-07-23 License: Perl Artistic License Price:
825 downloads
GD::Convert 2.12
GD::Convert is a Perl module with additional output formats for GD. more>>
GD::Convert is a Perl module with additional output formats for GD.
SYNOPSIS
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.
The new methods go into the GD namespace.
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=gif_netpbm
newFromGif=newFromGif_netpbm
newFromGifData=newFromGifData_netpbm
Use external commands from netpbm to load and create GIF images.
gif=gif_imagemagick
newFromGif=newFromGif_imagemagick
newFromGifData=newFromGifData_imagemagick
Use external commands from imagemagick to load and create GIF images.
gif=any
newFromGif=any
newFromGifData=any
Use any of the above methods to load and create GIF images.
wbmp
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:
$ppmdata = $image->ppm
Take a GD image and return a string with a PPM file as its content.
$xpmdata = $image->xpm
Take a GD image and return a string with a XPM file as its content.
$gifdata = $image->gif_netpbm([...])
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.
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.
$gifdata = $image->gif_imagemagick
This is the same as gif_netpbm, instead it is using the convert program of ImageMagick.
$image = GD::Image->newFromPpm($file, [$truecolor])
Create a GD image from the named ppm file or filehandle reference. Only raw ppm files (signature P6) are supported.
$image = GD::Image->newFromPpmData($data, [$truecolor])
Create a GD image from the data string containing ppm data. Only raw ppm files are supported.
$image = GD::Image->newFromGif_netpbm($file, [$truecolor]);
Create a GD image from the named file or filehandle reference using external netpbm programs.
$image = GD::Image->newFromGifData_netpbm($file, [$truecolor]);
Create a GD image from the data string using external netpbm programs.
$image = GD::Image->newFromGif_imagemagick($file, [$truecolor]);
Create a GD image from the named file or filehandle reference using external ImageMagick programs.
$image = GD::Image->newFromGifData_imagemagick($file, [$truecolor]);
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.
<<lessSYNOPSIS
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.
The new methods go into the GD namespace.
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=gif_netpbm
newFromGif=newFromGif_netpbm
newFromGifData=newFromGifData_netpbm
Use external commands from netpbm to load and create GIF images.
gif=gif_imagemagick
newFromGif=newFromGif_imagemagick
newFromGifData=newFromGifData_imagemagick
Use external commands from imagemagick to load and create GIF images.
gif=any
newFromGif=any
newFromGifData=any
Use any of the above methods to load and create GIF images.
wbmp
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:
$ppmdata = $image->ppm
Take a GD image and return a string with a PPM file as its content.
$xpmdata = $image->xpm
Take a GD image and return a string with a XPM file as its content.
$gifdata = $image->gif_netpbm([...])
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.
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.
$gifdata = $image->gif_imagemagick
This is the same as gif_netpbm, instead it is using the convert program of ImageMagick.
$image = GD::Image->newFromPpm($file, [$truecolor])
Create a GD image from the named ppm file or filehandle reference. Only raw ppm files (signature P6) are supported.
$image = GD::Image->newFromPpmData($data, [$truecolor])
Create a GD image from the data string containing ppm data. Only raw ppm files are supported.
$image = GD::Image->newFromGif_netpbm($file, [$truecolor]);
Create a GD image from the named file or filehandle reference using external netpbm programs.
$image = GD::Image->newFromGifData_netpbm($file, [$truecolor]);
Create a GD image from the data string using external netpbm programs.
$image = GD::Image->newFromGif_imagemagick($file, [$truecolor]);
Create a GD image from the named file or filehandle reference using external ImageMagick programs.
$image = GD::Image->newFromGifData_imagemagick($file, [$truecolor]);
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.
Download (0.010MB)
Added: 2006-08-10 License: GPL (GNU General Public License) Price:
1173 downloads
GD::Graph 1.4308
GD::Graph is a graph plotting module for Perl 5. more>>
GD::Graph is a graph plotting module for Perl 5.
SYNOPSIS
use GD::Graph::moduleName;
GD::Graph is a perl5 module to create charts using the GD module. The following classes for graphs with axes are defined:
GD::Graph::lines
Create a line chart.
GD::Graph::bars and GD::Graph::hbars
Create a bar chart with vertical or horizontal bars.
GD::Graph::points
Create an chart, displaying the data as points.
GD::Graph::linespoints
Combination of lines and points.
GD::Graph::area
Create a graph, representing the data as areas under a line.
GD::Graph::mixed
Create a mixed type graph, any combination of the above. At the moment this is fairly limited. Some of the options that can be used with some of the individual graph types wont work very well. Bar graphs drawn after lines or points graphs may obscure the earlier data, and specifying bar_width will not produce the results you probably expected.
Additional types:
GD::Graph::pie
Create a pie chart.
USAGE:
Fill an array of arrays with the x values and the values of the data sets. Make sure that every array is the same size, otherwise GD::Graph will complain and refuse to compile the graph.
@data = (
["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"],
[ 1, 2, 5, 6, 3, 1.5, 1, 3, 4],
[ sort { $a $b } (1, 2, 5, 6, 3, 1.5, 1, 3, 4) ]
);
If you dont have a value for a point in a certain dataset, you can use undef, and the point will be skipped.
Create a new GD::Graph object by calling the new method on the graph type you want to create (chart is bars, hbars, lines, points, linespoints, mixed or pie).
my $graph = GD::Graph::chart->new(400, 300);
Set the graph options.
$graph->set(
x_label => X Label,
y_label => Y label,
title => Some simple graph,
y_max_value => 8,
y_tick_number => 8,
y_label_skip => 2
) or die $graph->error;
and plot the graph.
my $gd = $graph->plot(@data) or die $graph->error;
Then do whatever your current version of GD allows you to do to save the file. For versions of GD older than 1.19 (or more recent than 2.15), youd do something like:
open(IMG, >file.gif) or die $!;
binmode IMG;
print IMG $gd->gif;
close IMG;
and for newer versions (1.20 and up) youd write
open(IMG, >file.png) or die $!;
binmode IMG;
print IMG $gd->png;
or
open(IMG, >file.gd2) or die $!;
binmode IMG;
print IMG $gd->gd2;
Then theres also of course the possibility of using a shorter version (for each of the export functions that GD supports):
print IMG $graph->plot(@data)->gif;
print IMG $graph->plot(@data)->png;
print IMG $graph->plot(@data)->gd;
print IMG $graph->plot(@data)->gd2;
If you want to write something that doesnt require your code to know whether to use gif or png, you could do something like:
if ($gd->can(png)) { # blabla }
or you can use the convenience method export_format:
my $format = $graph->export_format;
open(IMG, ">file.$format") or die $!;
binmode IMG;
print IMG $graph->plot(@data)->$format();
close IMG;
or for CGI programs:
use CGI qw(:standard);
#...
my $format = $graph->export_format;
print header("image/$format");
binmode STDOUT;
print $graph->plot(@data)->$format();
(the parentheses after $format are necessary, to help the compiler decide that you mean a method name there)
<<lessSYNOPSIS
use GD::Graph::moduleName;
GD::Graph is a perl5 module to create charts using the GD module. The following classes for graphs with axes are defined:
GD::Graph::lines
Create a line chart.
GD::Graph::bars and GD::Graph::hbars
Create a bar chart with vertical or horizontal bars.
GD::Graph::points
Create an chart, displaying the data as points.
GD::Graph::linespoints
Combination of lines and points.
GD::Graph::area
Create a graph, representing the data as areas under a line.
GD::Graph::mixed
Create a mixed type graph, any combination of the above. At the moment this is fairly limited. Some of the options that can be used with some of the individual graph types wont work very well. Bar graphs drawn after lines or points graphs may obscure the earlier data, and specifying bar_width will not produce the results you probably expected.
Additional types:
GD::Graph::pie
Create a pie chart.
USAGE:
Fill an array of arrays with the x values and the values of the data sets. Make sure that every array is the same size, otherwise GD::Graph will complain and refuse to compile the graph.
@data = (
["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"],
[ 1, 2, 5, 6, 3, 1.5, 1, 3, 4],
[ sort { $a $b } (1, 2, 5, 6, 3, 1.5, 1, 3, 4) ]
);
If you dont have a value for a point in a certain dataset, you can use undef, and the point will be skipped.
Create a new GD::Graph object by calling the new method on the graph type you want to create (chart is bars, hbars, lines, points, linespoints, mixed or pie).
my $graph = GD::Graph::chart->new(400, 300);
Set the graph options.
$graph->set(
x_label => X Label,
y_label => Y label,
title => Some simple graph,
y_max_value => 8,
y_tick_number => 8,
y_label_skip => 2
) or die $graph->error;
and plot the graph.
my $gd = $graph->plot(@data) or die $graph->error;
Then do whatever your current version of GD allows you to do to save the file. For versions of GD older than 1.19 (or more recent than 2.15), youd do something like:
open(IMG, >file.gif) or die $!;
binmode IMG;
print IMG $gd->gif;
close IMG;
and for newer versions (1.20 and up) youd write
open(IMG, >file.png) or die $!;
binmode IMG;
print IMG $gd->png;
or
open(IMG, >file.gd2) or die $!;
binmode IMG;
print IMG $gd->gd2;
Then theres also of course the possibility of using a shorter version (for each of the export functions that GD supports):
print IMG $graph->plot(@data)->gif;
print IMG $graph->plot(@data)->png;
print IMG $graph->plot(@data)->gd;
print IMG $graph->plot(@data)->gd2;
If you want to write something that doesnt require your code to know whether to use gif or png, you could do something like:
if ($gd->can(png)) { # blabla }
or you can use the convenience method export_format:
my $format = $graph->export_format;
open(IMG, ">file.$format") or die $!;
binmode IMG;
print IMG $graph->plot(@data)->$format();
close IMG;
or for CGI programs:
use CGI qw(:standard);
#...
my $format = $graph->export_format;
print header("image/$format");
binmode STDOUT;
print $graph->plot(@data)->$format();
(the parentheses after $format are necessary, to help the compiler decide that you mean a method name there)
Download (0.14MB)
Added: 2007-04-24 License: Perl Artistic License Price:
915 downloads
GD::Dashboard 0.04
GD::Dashboard is a Perl module to create JPEG graphics of meters and dials. more>>
GD::Dashboard is a Perl module to create JPEG graphics of meters and dials.
SYNOPSIS
my $dash = new GD::Dashboard();
my $g1 = new GD::Dashboard::Gauge(
MIN=>0,
MAX=>$empcnt,
VAL=>$nopwp_cnt,
NA1=>3.14/2+0.85,
NA2=>3.14/2-0.85,
NX=>51,NY=>77,NLEN=>50
);
$dash->add_meter(RPM, $g1);
$dash->write_jpeg(dash.jpg);
The Dashboard module aims at providing users with a quick and easy way to create dashboard or cockpit like JPGs to display key information.
Dashboard supports the following instruments:
* Gauges with needles
* Bar type gauges
* Warning Lights
Dashboard is built on top of GD.pm, Licoln Steins interface to the GD library.
<<lessSYNOPSIS
my $dash = new GD::Dashboard();
my $g1 = new GD::Dashboard::Gauge(
MIN=>0,
MAX=>$empcnt,
VAL=>$nopwp_cnt,
NA1=>3.14/2+0.85,
NA2=>3.14/2-0.85,
NX=>51,NY=>77,NLEN=>50
);
$dash->add_meter(RPM, $g1);
$dash->write_jpeg(dash.jpg);
The Dashboard module aims at providing users with a quick and easy way to create dashboard or cockpit like JPGs to display key information.
Dashboard supports the following instruments:
* Gauges with needles
* Bar type gauges
* Warning Lights
Dashboard is built on top of GD.pm, Licoln Steins interface to the GD library.
Download (0.023MB)
Added: 2006-07-31 License: Perl Artistic License Price:
1187 downloads
GD::Thumbnail 1.01
GD::Thumbnail is a thumbnail maker for GD. more>>
GD::Thumbnail is a thumbnail maker for GD.
SYNOPSIS
use GD::Thumbnail;
my $thumb = GD::Thumbnail->new;
my $raw = $thumb->create(test.jpg, 80, 2);
my $mime = $thumb->mime;
warn sprintf "Dimension: %sx%sn", $thumb->width, $thumb->height;
open IMG, ">thumb.$mime" or die "Error: $!";
binmode IMG;
print IMG $raw;
close IMG;
or
use CGI qw(:standard);
use GD::Thumbnail;
my $thumb = GD::Thumbnail->new;
my $raw = $thumb->create(test.jpg, 80, 2);
my $mime = $thumb->mime;
binmode STDOUT;
print header(-type => "image/$mime");
print $raw;
This a thumbnail maker. Thumbnails are smaller versions of the original image/graphic/picture and are used for preview purposes, where bigger images can take a long time to load. They are also used in image galleries to preview a lot of images at a time.
This module also has the capability to add information strips about the original image. Original images size (in bytes) and resolution & mime type can be added to the thumbnails upper and lower parts. This feature can be useful for web software (image galleries or forums).
This is a Yet Another type of module. There are several other thumbnail modules on CPAN, but they simply dont have the features I need, so this module is written to increase the thumbnail population on CPAN.
The module can raise an exception if something goes wrong. So, you may have to use an eval block to catch them.
<<lessSYNOPSIS
use GD::Thumbnail;
my $thumb = GD::Thumbnail->new;
my $raw = $thumb->create(test.jpg, 80, 2);
my $mime = $thumb->mime;
warn sprintf "Dimension: %sx%sn", $thumb->width, $thumb->height;
open IMG, ">thumb.$mime" or die "Error: $!";
binmode IMG;
print IMG $raw;
close IMG;
or
use CGI qw(:standard);
use GD::Thumbnail;
my $thumb = GD::Thumbnail->new;
my $raw = $thumb->create(test.jpg, 80, 2);
my $mime = $thumb->mime;
binmode STDOUT;
print header(-type => "image/$mime");
print $raw;
This a thumbnail maker. Thumbnails are smaller versions of the original image/graphic/picture and are used for preview purposes, where bigger images can take a long time to load. They are also used in image galleries to preview a lot of images at a time.
This module also has the capability to add information strips about the original image. Original images size (in bytes) and resolution & mime type can be added to the thumbnails upper and lower parts. This feature can be useful for web software (image galleries or forums).
This is a Yet Another type of module. There are several other thumbnail modules on CPAN, but they simply dont have the features I need, so this module is written to increase the thumbnail population on CPAN.
The module can raise an exception if something goes wrong. So, you may have to use an eval block to catch them.
Download (0.025MB)
Added: 2006-08-25 License: Perl Artistic License Price:
1158 downloads
GD::SecurityImage 1.61
GD::SecurityImage is a security image (captcha) generator. more>>
GD::SecurityImage is a security image (captcha) generator.
SYNOPSIS
use GD::SecurityImage;
# Create a normal image
my $image = GD::SecurityImage->new(width => 80,
height => 30,
lines => 10,
gd_font => giant);
$image->random($your_random_str);
$image->create(normal => rect);
my($image_data, $mime_type, $random_number) = $image->out;
or
# use external ttf font
my $image = GD::SecurityImage->new(width => 100,
height => 40,
lines => 10,
font => "/absolute/path/to/your.ttf",
scramble => 1);
$image->random($your_random_str);
$image->create(ttf => default);
$image->particle;
my($image_data, $mime_type, $random_number) = $image->out;
or you can just say (most of the public methods can be chained)
my($image, $type, $rnd) = GD::SecurityImage->new->random->create->particle->out;
to create a security image with the default settings. But that may not be useful. If you require the module, you must import it:
require GD::SecurityImage;
GD::SecurityImage->import;
The module also supports Image::Magick, but the default interface uses the GD module. To enable Image::Magick support, you must call the module with the use_magick option:
use GD::SecurityImage use_magick => 1;
If you require the module, you must import it:
require GD::SecurityImage;
GD::SecurityImage->import(use_magick => 1);
The module does not export anything actually. But import loads the necessary sub modules. If you don t import, the required modules will not be loaded and probably, youll die().
The (so called) "Security Images" are so popular. Most internet software use these in their registration screens to block robot programs (which may register tons of fake member accounts). Security images are basicaly, graphical CAPTCHAs (Completely Automated Public Turing Test to Tell Computers and Humans Apart). This module gives you a basic interface to create such an image. The final output is the actual graphic data, the mime type of the graphic and the created random string. The module also has some "styles" that are used to create the background (or foreground) of the image.
If you are an Authen::Captcha user, see GD::SecurityImage::AC for migration from Authen::Captcha to GD::SecurityImage.
This module is just an image generator. Not a captcha handler. The validation of the generated graphic is left to your programming taste.
<<lessSYNOPSIS
use GD::SecurityImage;
# Create a normal image
my $image = GD::SecurityImage->new(width => 80,
height => 30,
lines => 10,
gd_font => giant);
$image->random($your_random_str);
$image->create(normal => rect);
my($image_data, $mime_type, $random_number) = $image->out;
or
# use external ttf font
my $image = GD::SecurityImage->new(width => 100,
height => 40,
lines => 10,
font => "/absolute/path/to/your.ttf",
scramble => 1);
$image->random($your_random_str);
$image->create(ttf => default);
$image->particle;
my($image_data, $mime_type, $random_number) = $image->out;
or you can just say (most of the public methods can be chained)
my($image, $type, $rnd) = GD::SecurityImage->new->random->create->particle->out;
to create a security image with the default settings. But that may not be useful. If you require the module, you must import it:
require GD::SecurityImage;
GD::SecurityImage->import;
The module also supports Image::Magick, but the default interface uses the GD module. To enable Image::Magick support, you must call the module with the use_magick option:
use GD::SecurityImage use_magick => 1;
If you require the module, you must import it:
require GD::SecurityImage;
GD::SecurityImage->import(use_magick => 1);
The module does not export anything actually. But import loads the necessary sub modules. If you don t import, the required modules will not be loaded and probably, youll die().
The (so called) "Security Images" are so popular. Most internet software use these in their registration screens to block robot programs (which may register tons of fake member accounts). Security images are basicaly, graphical CAPTCHAs (Completely Automated Public Turing Test to Tell Computers and Humans Apart). This module gives you a basic interface to create such an image. The final output is the actual graphic data, the mime type of the graphic and the created random string. The module also has some "styles" that are used to create the background (or foreground) of the image.
If you are an Authen::Captcha user, see GD::SecurityImage::AC for migration from Authen::Captcha to GD::SecurityImage.
This module is just an image generator. Not a captcha handler. The validation of the generated graphic is left to your programming taste.
Download (0.060MB)
Added: 2006-07-31 License: Perl Artistic License Price:
1180 downloads
GD::Graph::Polar 0.15
GD::Graph::Polar is a Perl module to make polar graph using GD package. more>>
GD::Graph::Polar is a Perl module to make polar graph using GD package.
SYNOPSIS
use GD::Graph::Polar;
my $obj=GD::Graph::Polar->new(size=>480, radius=>100);
$obj->addPoint (50=>25);
$obj->addPoint_rad (50=>3.1415);
$obj->addGeoPoint (75=>25);
$obj->addGeoPoint_rad (75=>3.1415);
$obj->addLine($r0=>$t0, $r1=>$t1);
$obj->addLine_rad($r0=>$t0, $r1=>$t1);
$obj->addGeoLine($r0=>$t0, $r1=>$t1);
$obj->addGeoLine_rad($r0=>$t0, $r1=>$t1);
$obj->addArc($r0=>$t0, $r1=>$t1);
$obj->addArc_rad($r0=>$t0, $r1=>$t1);
$obj->addGeoArc($r0=>$t0, $r1=>$t1);
$obj->addGeoArc_rad($r0=>$t0, $r1=>$t1);
$obj->addString($r=>$t, "Hello World!");
$obj->addString_rad($r=>$t, "Hello World!");
$obj->addGeoString($r=>$t, "Hello World!");
$obj->addGeoString_rad($r=>$t, "Hello World!");
$obj->font(gdSmallFont); #sets the current font from GD exports
$obj->color("blue"); #sets the current color from Graphics::ColorNames
$obj->color([0,0,0]); #sets the current color [red,green,blue]
print $obj->draw;
<<lessSYNOPSIS
use GD::Graph::Polar;
my $obj=GD::Graph::Polar->new(size=>480, radius=>100);
$obj->addPoint (50=>25);
$obj->addPoint_rad (50=>3.1415);
$obj->addGeoPoint (75=>25);
$obj->addGeoPoint_rad (75=>3.1415);
$obj->addLine($r0=>$t0, $r1=>$t1);
$obj->addLine_rad($r0=>$t0, $r1=>$t1);
$obj->addGeoLine($r0=>$t0, $r1=>$t1);
$obj->addGeoLine_rad($r0=>$t0, $r1=>$t1);
$obj->addArc($r0=>$t0, $r1=>$t1);
$obj->addArc_rad($r0=>$t0, $r1=>$t1);
$obj->addGeoArc($r0=>$t0, $r1=>$t1);
$obj->addGeoArc_rad($r0=>$t0, $r1=>$t1);
$obj->addString($r=>$t, "Hello World!");
$obj->addString_rad($r=>$t, "Hello World!");
$obj->addGeoString($r=>$t, "Hello World!");
$obj->addGeoString_rad($r=>$t, "Hello World!");
$obj->font(gdSmallFont); #sets the current font from GD exports
$obj->color("blue"); #sets the current color from Graphics::ColorNames
$obj->color([0,0,0]); #sets the current color [red,green,blue]
print $obj->draw;
Download (0.046MB)
Added: 2007-04-24 License: Perl Artistic License Price:
547 downloads
GD::Tab::Ukulele 0.01
GD::Tab::Ukulele is a Perl module for Ukulele tab image generator. more>>
GD::Tab::Ukulele is a Perl module for Ukulele tab image generator.
SYNOPSIS
use GD::Tab::Ukulele;
my $uk = GD::Tab::Ukulele->new;
# print png image
print $uk->chord(D#sus4)->png;
# get GD::Image instance
my $im = $uk->chord(C);
print $im->png;
# other tab generate
$uk->generate(D7,[0,2,0,2])->png;
# set color
$uk->color(255, 0, 0);
# set background-color and no interlace
$uk->bgcolor(200, 200, 200);
$uk->interlaced(0);
# all tabs image save to file.
use IO::File;
for my $chord (@{$uk->all_chords}) {
(my $filename = $chord) =~ s/M/Maj/; # for case-insensitive filesystem
my $file = IO::File->new("images/$filename.png", w);
$file->print($uk->chord($chord)->png);
}
<<lessSYNOPSIS
use GD::Tab::Ukulele;
my $uk = GD::Tab::Ukulele->new;
# print png image
print $uk->chord(D#sus4)->png;
# get GD::Image instance
my $im = $uk->chord(C);
print $im->png;
# other tab generate
$uk->generate(D7,[0,2,0,2])->png;
# set color
$uk->color(255, 0, 0);
# set background-color and no interlace
$uk->bgcolor(200, 200, 200);
$uk->interlaced(0);
# all tabs image save to file.
use IO::File;
for my $chord (@{$uk->all_chords}) {
(my $filename = $chord) =~ s/M/Maj/; # for case-insensitive filesystem
my $file = IO::File->new("images/$filename.png", w);
$file->print($uk->chord($chord)->png);
}
Download (0.005MB)
Added: 2007-04-24 License: Perl Artistic License Price:
914 downloads
GD::Graph::colour 1.44
GD::Graph::colour contains colour manipulation routines for use with GD::Graph. more>>
GD::Graph::colour contains colour manipulation routines for use with GD::Graph.
SYNOPSIS
use GD::Graph::colour qw(:colours :lists :files :convert);
The GD::Graph::colour package provides a few routines to work with colours. The functionality of this package is mainly defined by what is needed, now and historically, by the GD::Graph modules.
FUNCTIONS
colour_list( number of colours )
Returns a list of number of colours colour names known to the package. Exported with the :lists tag.
sorted_colour_list( number of colours )
Returns a list of number of colours colour names known to the package, sorted by luminance or hue. NB. Right now it always sorts by luminance. Will add an option in a later stage to decide sorting method at run time. Exported with the :lists tag.
_rgb( colour name )
Returns a list of the RGB values of colour name. if the colour name is a string of the form that is acceptable to the hex2rgb sub, then the colour will be added to the list dynamically. Exported with the :colours tag.
_hue( R,G,B )
Returns the hue of the colour with the specified RGB values. Exported with the :colours tag.
_luminance( R,G,B )
Returns the luminance of the colour with the specified RGB values. Exported with the :colours tag.
add_colour(colourname => [$r, $g, $b]) or add_colour(#7fe310)
Self-explanatory. Exported with the :colours tag.
rgb2hex($red, $green, $blue)
hex2rgb(#7fe310)
These functions translate a list of RGB values into a hexadecimal string, as is commonly used in HTML and the Image::Magick API, and vice versa. Exported with the :convert tag.
read_rgb( file name )
Reads in colours from a rgb file as used by the X11 system.
Doing something like:
use GD::Graph::bars;
use GD::Graph::colour;
GD::Graph::colour::read_rgb("rgb.txt") or die "cannot read colours";
Will allow you to use any colours defined in rgb.txt in your graph. Exported with the :files tag.
<<lessSYNOPSIS
use GD::Graph::colour qw(:colours :lists :files :convert);
The GD::Graph::colour package provides a few routines to work with colours. The functionality of this package is mainly defined by what is needed, now and historically, by the GD::Graph modules.
FUNCTIONS
colour_list( number of colours )
Returns a list of number of colours colour names known to the package. Exported with the :lists tag.
sorted_colour_list( number of colours )
Returns a list of number of colours colour names known to the package, sorted by luminance or hue. NB. Right now it always sorts by luminance. Will add an option in a later stage to decide sorting method at run time. Exported with the :lists tag.
_rgb( colour name )
Returns a list of the RGB values of colour name. if the colour name is a string of the form that is acceptable to the hex2rgb sub, then the colour will be added to the list dynamically. Exported with the :colours tag.
_hue( R,G,B )
Returns the hue of the colour with the specified RGB values. Exported with the :colours tag.
_luminance( R,G,B )
Returns the luminance of the colour with the specified RGB values. Exported with the :colours tag.
add_colour(colourname => [$r, $g, $b]) or add_colour(#7fe310)
Self-explanatory. Exported with the :colours tag.
rgb2hex($red, $green, $blue)
hex2rgb(#7fe310)
These functions translate a list of RGB values into a hexadecimal string, as is commonly used in HTML and the Image::Magick API, and vice versa. Exported with the :convert tag.
read_rgb( file name )
Reads in colours from a rgb file as used by the X11 system.
Doing something like:
use GD::Graph::bars;
use GD::Graph::colour;
GD::Graph::colour::read_rgb("rgb.txt") or die "cannot read colours";
Will allow you to use any colours defined in rgb.txt in your graph. Exported with the :files tag.
Download (0.15MB)
Added: 2007-08-07 License: Perl Artistic License Price:
808 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above gd search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed