GD(3pm)

✨ GD πŸ’…

okay bestie, welcome to GD β€” that's the GD(3pm) page from the User Contributed Perl Documentation, and no I will not be normal about it. this whole thing is the PDL::IO::GD ride, and it's long, so buckle up. 🌸


πŸ’– NAME πŸ’–

PDL::IO::GD β€” Interface to the GD image library. that's it, that's the name, she's simple and she serves. πŸŽ€


✨ SYNOPSIS ✨

my $pdl = sequence(byte, 30, 30);
write_png($pdl, load_lut($lutfile), "test.png");

write_true_png(sequence(100, 100, 3), "test_true.png");

my $image = read_png("test.png");

my $image = read_true_png("test_true_read.png");
write_true_png($image, "test_true_read.out.png");

my $lut = read_png_lut("test.png");

$pdl = sequence(byte, 30, 30);
write_png_ex($pdl, load_lut($lutfile), "test_nocomp.png", 0);
write_png_ex($pdl, load_lut($lutfile), "test_bestcomp1.png", 9);
write_png_best($pdl, load_lut($lutfile), "test_bestcomp2.png");

$pdl = sequence(100, 100, 3);
write_true_png_ex($pdl, "test_true_nocomp.png", 0);
write_true_png_ex($pdl, "test_true_bestcomp1.png", 9);
write_true_png_best($pdl, "test_true_bestcomp2.png");

recompress_png_best("test_recomp_best.png");

like, look at her go. iconic behavior. πŸ¦‹


🌈 DESCRIPTION 🌈

so this is the "General Interface" for the PDL::IO::GD library, and ngl it's literally several years old at this point (read: stable, she's not going anywhere, she's the moment). if you're feeling frisky though, go try the new OO interface, it's described further down. 😌

the general version just hands you a bunch of image IO utility functions you can use with ndarray variables. and the way it's deceptively useful?? yeah. fr fr. πŸ’…


πŸ”₯ FUNCTIONS πŸ”₯

🌟 write_png

Signature: (img(x,y); lut(i=3,j); char* filename)
Types: (byte)
write_png($img, $lut, $filename); # all arguments given
$img->write_png($lut, $filename); # method call

Writes a 2-d PDL variable out to a PNG file, using the color look-up-table ndarray you hand it (from here on out we're calling that a LUT, bestie, keep up 🫢).

The LUT contains a line for each value 0-255, with a corresponding R, G, and B value. one line per value, all the way down. periodt.

Broadcasts over its inputs.

⚠️ write_png does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays. so like, know that going in. πŸ’€

🌟 write_png_ex

Signature: (img(x,y); lut(i=3,j); char* filename; int level)
Types: (byte)
write_png_ex($img, $lut, $filename, $level); # all arguments given
$img->write_png_ex($lut, $filename, $level); # method call

Same as write_png(), except you get to specify the compression level (0-9) as the last argument. you're in charge now, bestie. πŸ‘‘

Broadcasts over its inputs.

⚠️ write_png_ex does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

🌟 write_true_png

Signature: (img(x,y,z=3); char* filename)
Types: (byte)
write_true_png($img, $filename); # all arguments given
$img->write_true_png($filename); # method call

Writes an (x, y, z(3)) PDL variable out to a PNG file, using a true color format. ✨

This means a larger file on disk, but it can contain more than 256 colors. bigger file, bigger palette energy, it's giving range. 🌈

Broadcasts over its inputs.

⚠️ write_true_png does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

🌟 write_true_png_ex

Signature: (img(x,y,z=3); char* filename; int level)
Types: (byte)
write_true_png_ex($img, $filename, $level); # all arguments given
$img->write_true_png_ex($filename, $level); # method call

Same as write_true_png(), except you can specify the compression level (0-9) as the last argument. same energy, more control. πŸ’…

Broadcasts over its inputs.

⚠️ write_true_png_ex does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

🌟 write_png_best

Like write_png(), but it assumes the best PNG compression (9). maximum effort, no notes. πŸ”₯

write_png_best( $img(ndarray), $lut(ndarray), $filename )

🌟 write_true_png_best

Like write_true_png(), but it assumes the best PNG compression (9). she's doing the most and that's the point. πŸ‘‘

write_true_png_best( $img(ndarray), $filename )

🌟 load_lut( $filename )

Loads a color look up table from an ASCII file. returns an ndarray. πŸŽ€

🌟 read_true_png

Signature: ([o] img(x=CALC(gdImageSX($COMP(im))),y=CALC(gdImageSY($COMP(im))),z=3); char* filename)
Types: (byte)
$img = read_true_png($filename);
read_true_png($img, $filename);  # all arguments given
$img = $filename->read_true_png; # method call
$img->read_true_png($filename);

Reads a true colour PNG image into a (new) PDL variable. new pdl, who dis. πŸ’–

Broadcasts over its inputs.

⚠️ read_true_png does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

🌟 read_png

Signature: ([o] img(x=CALC(gdImageSX($COMP(im))),y=CALC(gdImageSY($COMP(im)))); char* filename)
Types: (long)
$img = read_png($filename);
read_png($img, $filename);  # all arguments given
$img = $filename->read_png; # method call
$img->read_png($filename);

Reads a (palette) PNG image into a (new) PDL variable. palette girlies rise up. 🎨

Broadcasts over its inputs.

⚠️ read_png does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

🌟 read_png_lut

Signature: ([o] lut(c=3,i=256); char* filename)
Types: (byte)
$lut = read_png_lut($filename);
read_png_lut($lut, $filename);  # all arguments given
$lut = $filename->read_png_lut; # method call
$lut->read_png_lut($filename);

Reads a color LUT from an already-existing palette PNG file. yes, already-existing β€” she can't invent one out of thin air, bestie. πŸ¦‹

Broadcasts over its inputs.

⚠️ read_png_lut does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

🌟 write_gif_anim

Signature: (img(c=3,x,y,n); char* filename; int Loops; int Delay)
Types: (byte)
write_gif_anim($img, $filename, $Loops, $Delay); # all arguments given
$img->write_gif_anim($filename, $Loops, $Delay); # method call

Writes an image cube to a file as an animated GIF. main character energy fr. 🌟

RGB dimension is first. y=0 is at bottom. 0 loops = infinite (default). Delay is in 100ths of a second, default 4.

Broadcasts over its inputs. Can't use POSIX threads. πŸ’€

⚠️ write_gif_anim does not process bad values. It will set the bad-value flag of all output ndarrays if the flag is set for any of the input ndarrays.

πŸ¦‹ OO INTERFACE πŸ¦‹

Object Oriented interface to the GD image library. glow up complete. ✨

✨ SYNOPSIS ✨

# Open an existing file:
#
my $gd = PDL::IO::GD->new( { filename => "test.png" } );

# Query the x and y sizes:
my $x = $gd->SX();
my $y = $gd->SY();

# Grab the PDL of the data:
my $pdl = $gd->to_pdl; # (x,y,3) y=0 at top

# Grab the PDL of the data:
my $pdl = $gd->to_rpic; # (3,x,y) y=0 at bottom

# Kill this thing:
$gd->DESTROY();

# Create a new object:
#
my $im = PDL::IO::GD->new( { x => 300, y => 300 } );

# Allocate some colors:
#
my $black = $im->ColorAllocate( 0, 0, 0 );
my $red = $im->ColorAllocate( 255, 0, 0 );
my $green = $im->ColorAllocate( 0, 255, 0 );
my $blue = $im->ColorAllocate( 0, 0, 255 );

# Draw a rectangle:
$im->Rectangle( 10, 10, 290, 290, $red );

# Add some text:
$im->String( gdFontGetLarge(), 20, 20, "Test Large Font!", $green );

# Write the output file:
$im->write_Png( "test2.png" );

🌈 DESCRIPTION 🌈

This is the Object-Oriented interface from PDL to the GD image library. πŸ’…

See http://www.boutell.com/gd/ for more information on the GD library and how it works. go read, iykyk.

🧚 IMPLEMENTATION NOTES 🧚

Surprisingly enough, this interface has nothing to do with the other Perl->GD interface module, aka 'GD' (as in 'use GD;'). This is done from scratch over the years. not a remix, an original. 😀

Requires at least version 2.0.22 of the GD library, but it's only been thoroughly tested with gd-2.0.33, so it would be best to use that. The 2.0.22 requirement has to do with a change in GD's font handling functions, so if you don't use those, then don't worry about it.

I should also add, the statement about "thoroughly tested" above is mostly a joke. This OO interface is very young, and it has barely been tested at all, so if something breaks, email me and I'll get it fixed ASAP (for me). 😭 like bestie please, it's giving beta.

Functions that manipulate and query the image objects generally have a 'gdImage' prefix on the function names (ex: gdImageString()). I've created aliases here for all of those member functions so you don't have to keep typing 'gdImage' in your code, but the long version are in there as well. shortcuts, but the long forms stay too. 🫢


πŸ‘‘ METHODS πŸ‘‘

🌟 new

Creates a new PDL::IO::GD object. ✨

Accepts a hash describing how to create the object. Accepts a single hash ( with curly braces ), an inline hash (the same, but without the braces) or a single string interpreted as a filename. Thus the following are all equivalent:

PDL::IO::GD->new( {filename => 'image.png'} );
PDL::IO::GD->new( filename => 'image.png' );
PDL::IO::GD->new( 'image.png' );

If the hash has:

  • pdl => $pdl_var (lut => $lut_ndarray) Then a new GD is created from that PDL variable.
  • filename => $file Then a new GD is created from the image file.
  • x => $num, y => $num Then a new GD is created as a palette image, with size x, y
  • x => $num, y => $num, true_color => 1 Then a new GD is created as a true color image, with size x, y
  • data => $scalar (type => $typename) Then a new GD is created from the file data stored in $scalar. If no type is given, then it will try to guess the type of the data, but this will not work for WBMP and gd image types. For those types, you must specify the type of the data, or the operation will fail. Valid types are: 'jpg', 'png', 'gif', 'gd', 'gd2', 'wbmp'.

Example:

my $gd = PDL::IO::GD->new({ pdl => $pdl_var });

my $gd = PDL::IO::GD->new({ pdl => $pdl_var, lut => $lut_ndarray });

my $gd = PDL::IO::GD->new({ filename => "image.png" });

my $gd = PDL::IO::GD->new({ x => 100, y => 100 });

my $gd = PDL::IO::GD->new({ x => 100, y => 100, true_color => 1 });

my $gd = PDL::IO::GD->new({ data => $imageData });

my $gd = PDL::IO::GD->new({ data => $imageData, type => 'wbmp' });

🌟 to_pdl

When you're done playing with your GDImage and want an ndarray back, use this function to return one. For true-colour, RGB dim is highest (x,y,3). To get it in the lowest dim (and with y=0 is the bottom), use to_rpic. πŸŽ€

🌟 to_rpic

When you're done playing with your GDImage and want an ndarray back, use this function to return one. For true-colour, RGB dim is lowest (3,x,y). To get it in the highest dim (and with y=0 is the top), use to_pdl. πŸŽ€

🌟 apply_lut( $lut(ndarray) )

Does a $im->ColorAllocate() for an entire LUT ndarray at once. one call, whole table, efficiency queen. πŸ‘‘

The LUT ndarray format is the same as for the general interface above.

⚠️ WARNING ⚠️

All of the docs below this point are auto-generated (not to mention the actual code), so read with a grain of salt, and always check the main GD documentation about how that function works and what it does. don't come for me, i didn't write it, i'm just the messenger. πŸ’€

🌟 write_Png

$image->write_Png( $filename )

write_PngEx

$image->write_PngEx( $filename, $level )

She's taking your whole lil artwork and putting it in a file. $filename is where it lands, $level is along for the ride ✨

write_WBMP

$image->write_WBMP( $fg, $filename )

WBMP o'clock πŸŽ€ you hand her $fg and $filename and she does her thing.

write_Jpeg

$image->write_Jpeg( $filename, $quality )

$filename + $quality, that's the whole vibe.

write_Gd

$image->write_Gd( $filename )

Just $filename, bestie. Nothing else needed πŸ’…

write_Gd2

$image->write_Gd2( $filename, $cs, $fmt )

$filename, $cs, $fmt β€” the full trio 🫢

write_Gif

$image->write_Gif( $filename )

$filename and that's it. Iconic, no notes.

get_Png_data

$image->get_Png_data(  )

No args at all. She just hands you the data back, periodt.

get_PngEx_data

$image->get_PngEx_data( $level )

$level is the only thing she wants πŸ¦‹

get_WBMP_data

$image->get_WBMP_data( $fg )

Pass $fg, get data. Simple as.

get_Jpeg_data

$image->get_Jpeg_data( $quality )

$quality in, data out 🌸

get_Gd_data

$image->get_Gd_data(  )

Zero args, all data πŸ’–

get_Gd2_data

$image->get_Gd2_data( $cs, $fmt )

$cs and $fmt, that's the whole shopping list.


okay now we're in the alias section and it is LONG, so buckle up πŸŽ€ every single one of these is the same function wearing a shorter name. Both versions work. Use whichever one feels right in your heart πŸ’…

SetPixel

$image->SetPixel( $x, $y, $color )

Alias for gdImageSetPixel.

gdImageSetPixel

$image->gdImageSetPixel( $x, $y, $color )

That's the one SetPixel is aliasing, iykyk.

GetPixel

$image->GetPixel( $x, $y )

Alias for gdImageGetPixel.

gdImageGetPixel

$image->gdImageGetPixel( $x, $y )

The real one behind GetPixel ✨

AABlend

$image->AABlend(  )

Alias for gdImageAABlend.

gdImageAABlend

$image->gdImageAABlend(  )

Same girl, full name πŸ’–

Line

$image->Line( $x1, $y1, $x2, $y2, $color )

Alias for gdImageLine.

gdImageLine

$image->gdImageLine( $x1, $y1, $x2, $y2, $color )

DashedLine

$image->DashedLine( $x1, $y1, $x2, $y2, $color )

Alias for gdImageDashedLine.

gdImageDashedLine

$image->gdImageDashedLine( $x1, $y1, $x2, $y2, $color )

Rectangle

$image->Rectangle( $x1, $y1, $x2, $y2, $color )

Alias for gdImageRectangle.

gdImageRectangle

$image->gdImageRectangle( $x1, $y1, $x2, $y2, $color )

FilledRectangle

$image->FilledRectangle( $x1, $y1, $x2, $y2, $color )

Alias for gdImageFilledRectangle.

gdImageFilledRectangle

$image->gdImageFilledRectangle( $x1, $y1, $x2, $y2, $color )

SetClip

$image->SetClip( $x1, $y1, $x2, $y2 )

Alias for gdImageSetClip.

gdImageSetClip

$image->gdImageSetClip( $x1, $y1, $x2, $y2 )

GetClip

$image->GetClip( $x1P, $y1P, $x2P, $y2P )

Alias for gdImageGetClip. (yes those args are the P versions, that's on purpose πŸ™ˆ)

gdImageGetClip

$image->gdImageGetClip( $x1P, $y1P, $x2P, $y2P )

BoundsSafe

$image->BoundsSafe( $x, $y )

Alias for gdImageBoundsSafe.

gdImageBoundsSafe

$image->gdImageBoundsSafe( $x, $y )

Char

$image->Char( $f, $x, $y, $c, $color )

Alias for gdImageChar.

gdImageChar

$image->gdImageChar( $f, $x, $y, $c, $color )

CharUp

$image->CharUp( $f, $x, $y, $c, $color )

Alias for gdImageCharUp.

gdImageCharUp

$image->gdImageCharUp( $f, $x, $y, $c, $color )

String

$image->String( $f, $x, $y, $s, $color )

Alias for gdImageString.

gdImageString

$image->gdImageString( $f, $x, $y, $s, $color )

StringUp

$image->StringUp( $f, $x, $y, $s, $color )

Alias for gdImageStringUp.

gdImageStringUp

$image->gdImageStringUp( $f, $x, $y, $s, $color )

String16

$image->String16( $f, $x, $y, $s, $color )

Alias for gdImageString16.

gdImageString16

$image->gdImageString16( $f, $x, $y, $s, $color )

StringUp16

$image->StringUp16( $f, $x, $y, $s, $color )

Alias for gdImageStringUp16.

gdImageStringUp16

$image->gdImageStringUp16( $f, $x, $y, $s, $color )

Polygon

$image->Polygon( $p, $n, $c )

Alias for gdImagePolygon.

gdImagePolygon

$image->gdImagePolygon( $p, $n, $c )

FilledPolygon

$image->FilledPolygon( $p, $n, $c )

Alias for gdImageFilledPolygon.

gdImageFilledPolygon

$image->gdImageFilledPolygon( $p, $n, $c )

ColorAllocate

$image->ColorAllocate( $r, $g, $b )

Alias for gdImageColorAllocate.

gdImageColorAllocate

$image->gdImageColorAllocate( $r, $g, $b )

ColorAllocateAlpha

$image->ColorAllocateAlpha( $r, $g, $b, $a )

Alias for gdImageColorAllocateAlpha.

gdImageColorAllocateAlpha

$image->gdImageColorAllocateAlpha( $r, $g, $b, $a )

ColorClosest

$image->ColorClosest( $r, $g, $b )

Alias for gdImageColorClosest.

gdImageColorClosest

$image->gdImageColorClosest( $r, $g, $b )

ColorClosestAlpha

$image->ColorClosestAlpha( $r, $g, $b, $a )

Alias for gdImageColorClosestAlpha.

gdImageColorClosestAlpha

$image->gdImageColorClosestAlpha( $r, $g, $b, $a )

ColorClosestHWB

$image->ColorClosestHWB( $r, $g, $b )

Alias for gdImageColorClosestHWB.

gdImageColorClosestHWB

$image->gdImageColorClosestHWB( $r, $g, $b )

ColorExact

$image->ColorExact( $r, $g, $b )

Alias for gdImageColorExact.

gdImageColorExact

$image->gdImageColorExact( $r, $g, $b )

ColorExactAlpha

$image->ColorExactAlpha( $r, $g, $b, $a )

Alias for gdImageColorExactAlpha.

gdImageColorExactAlpha

$image->gdImageColorExactAlpha( $r, $g, $b, $a )

ColorResolve

$image->ColorResolve( $r, $g, $b )

Alias for gdImageColorResolve.

gdImageColorResolve

$image->gdImageColorResolve( $r, $g, $b )

ColorResolveAlpha

$image->ColorResolveAlpha( $r, $g, $b, $a )

Alias for gdImageColorResolveAlpha.

gdImageColorResolveAlpha

$image->gdImageColorResolveAlpha( $r, $g, $b, $a )

ColorDeallocate

$image->ColorDeallocate( $color )

Alias for gdImageColorDeallocate.

gdImageColorDeallocate

$image->gdImageColorDeallocate( $color )

TrueColorToPalette

$image->TrueColorToPalette( $ditherFlag, $colorsWanted )

Alias for gdImageTrueColorToPalette.

gdImageTrueColorToPalette

$image->gdImageTrueColorToPalette( $ditherFlag, $colorsWanted )

ColorTransparent

$image->ColorTransparent( $color )

Alias for gdImageColorTransparent.

gdImageColorTransparent

$image->gdImageColorTransparent( $color )

FilledArc

$image->FilledArc( $cx, $cy, $w, $h, $s, $e, $color, $style )

Alias for gdImageFilledArc.

gdImageFilledArc

$image->gdImageFilledArc( $cx, $cy, $w, $h, $s, $e, $color, $style )

Arc

$image->Arc( $cx, $cy, $w, $h, $s, $e, $color )

Alias for gdImageArc.

gdImageArc

$image->gdImageArc( $cx, $cy, $w, $h, $s, $e, $color )

FilledEllipse

$image->FilledEllipse( $cx, $cy, $w, $h, $color )

Alias for gdImageFilledEllipse.

gdImageFilledEllipse

$image->gdImageFilledEllipse( $cx, $cy, $w, $h, $color )

FillToBorder

$image->FillToBorder( $x, $y, $border, $color )

Alias for gdImageFillToBorder.

gdImageFillToBorder

$image->gdImageFillToBorder( $x, $y, $border, $color )

Fill

$image->Fill( $x, $y, $color )

Alias for gdImageFill.

gdImageFill

$image->gdImageFill( $x, $y, $color )

CopyRotated

$image->CopyRotated( $dstX, $dstY, $srcX, $srcY, $srcWidth, $srcHeight,
$angle )

Alias for gdImageCopyRotated.

gdImageCopyRotated

$image->gdImageCopyRotated( $dstX, $dstY, $srcX, $srcY, $srcWidth,
$srcHeight, $angle )

SetBrush

$image->SetBrush(  )

Alias for gdImageSetBrush.

gdImageSetBrush

$image->gdImageSetBrush(  )

SetTile

$image->SetTile(  )

Alias for gdImageSetTile.

gdImageSetTile

$image->gdImageSetTile(  )

SetAntiAliased

$image->SetAntiAliased( $c )

Alias for gdImageSetAntiAliased.

gdImageSetAntiAliased

$image->gdImageSetAntiAliased( $c )

SetAntiAliasedDontBlend

$image->SetAntiAliasedDontBlend( $c, $dont_blend )

Alias for gdImageSetAntiAliasedDontBlend.

gdImageSetAntiAliasedDontBlend

$image->gdImageSetAntiAliasedDontBlend( $c, $dont_blend )

SetStyle

$image->SetStyle( $style, $noOfPixels )

Alias for gdImageSetStyle.

gdImageSetStyle

$image->gdImageSetStyle( $style, $noOfPixels )

SetThickness

$image->SetThickness( $thickness )

Alias for gdImageSetThickness.

gdImageSetThickness

$image->gdImageSetThickness( $thickness )

Interlace

$image->Interlace( $interlaceArg )

Alias for gdImageInterlace.

gdImageInterlace

$image->gdImageInterlace( $interlaceArg )

AlphaBlending

$image->AlphaBlending( $alphaBlendingArg )

Alias for gdImageAlphaBlending.

gdImageAlphaBlending

$image->gdImageAlphaBlending( $alphaBlendingArg )

SaveAlpha

$image->SaveAlpha( $saveAlphaArg )

Alias for gdImageSaveAlpha.

gdImageSaveAlpha

$image->gdImageSaveAlpha( $saveAlphaArg )

TrueColor

$image->TrueColor(  )

Alias for gdImageTrueColor.

gdImageTrueColor

$image->gdImageTrueColor(  )

ColorsTotal

$image->ColorsTotal(  )

Alias for gdImageColorsTotal.

gdImageColorsTotal

$image->gdImageColorsTotal(  )

Red

$image->Red( $c )

Alias for gdImageRed.

gdImageRed

$image->gdImageRed( $c )

Green

$image->Green( $c )

Alias for gdImageGreen.

gdImageGreen

$image->gdImageGreen( $c )

Blue

$image->Blue( $c )

Alias for gdImageBlue.

gdImageBlue

$image->gdImageBlue( $c )

Alpha

$image->Alpha( $c )

Alias for gdImageAlpha.

gdImageAlpha

$image->gdImageAlpha( $c )

GetTransparent

$image->GetTransparent(  )

Alias for gdImageGetTransparent.

gdImageGetTransparent

$image->gdImageGetTransparent(  )

GetInterlaced

$image->GetInterlaced(  )

Alias for gdImageGetInterlaced.

gdImageGetInterlaced

$image->gdImageGetInterlaced(  )

SX

$image->SX(  )

Alias for gdImageSX.

gdImageSX

$image->gdImageSX(  )

SY

$image->SY(  )

Alias for gdImageSY.

gdImageSY

$image->gdImageSY(  )

ColorAllocates

$image->ColorAllocates( $r(pdl), $g(pdl), $b(pdl) )

Alias for gdImageColorAllocates. (note the (pdl) on every arg, she's fancy like that πŸ’…)

gdImageColorAllocates

$image->gdImageColorAllocates( $r(pdl), $g(pdl), $b(pdl) )

ColorAllocateAlphas

$image->ColorAllocateAlphas( $r(pdl), $g(pdl), $b(pdl), $a(pdl) )

Alias for gdImageColorAllocateAlphas.

gdImageColorAllocateAlphas

$image->gdImageColorAllocateAlphas( $r(pdl), $g(pdl), $b(pdl), $a(pdl) )

SetPixels

$image->SetPixels( $x(pdl), $y(pdl), $color(pdl) )

Alias for gdImageSetPixels.

gdImageSetPixels

$image->gdImageSetPixels( $x(pdl), $y(pdl), $color(pdl) )

Lines

$image->Lines( $x1(pdl), $y1(pdl), $x2(pdl), $y2(pdl), $color(pdl) )

Alias for gdImageLines.

gdImageLines

$image->gdImageLines( $x1(pdl), $y1(pdl), $x2(pdl), $y2(pdl),
$color(pdl) )

DashedLines

$image->DashedLines( $x1(pdl), $y1(pdl), $x2(pdl), $y2(pdl), $color(pdl)
)

Alias for gdImageDashedLines.

gdImageDashedLines

$image->gdImageDashedLines( $x1(pdl), $y1(pdl), $x2(pdl), $y2(pdl),
$color(pdl) )

Rectangles

$image->Rectangles( $x1(pdl), $y1(pdl), $x2(pdl), $y2(pdl), $color(pdl)
)

Alias for gdImageRectangles.

gdImageRectangles

$image->gdImageRectangles( $x1(pdl), $y1(pdl), $x2(pdl), $y2(pdl),
$color(pdl) )

FilledRectangles

$image->FilledRectangles( $x1(pdl), $y1(pdl), $x2(pdl), $y2(pdl),
$color(pdl) )

Alias for gdImageFilledRectangles.

gdImageFilledRectangles

$image->gdImageFilledRectangles( $x1(pdl), $y1(pdl), $x2(pdl), $y2(pdl),
$color(pdl) )

FilledArcs

$image->FilledArcs( $cx(pdl), $cy(pdl), $w(pdl), $h(pdl), $s(pdl),
$e(pdl), $color(pdl), $style(pdl) )

Alias for gdImageFilledArcs.

gdImageFilledArcs

$image->gdImageFilledArcs( $cx(pdl), $cy(pdl), $w(pdl), $h(pdl),
$s(pdl), $e(pdl), $color(pdl), $style(pdl) )

Arcs πŸŽ€

$image->Arcs( $cx(pdl), $cy(pdl), $w(pdl), $h(pdl), $s(pdl), $e(pdl), $color(pdl) )

Just an alias for gdImageArcs, bestie. Same energy, shorter name. πŸ’…

gdImageArcs 🌈

$image->gdImageArcs( $cx(pdl), $cy(pdl), $w(pdl), $h(pdl), $s(pdl), $e(pdl), $color(pdl) )

The real one. Draw those arcs, queen. πŸ¦‹

FilledEllipses ✨

$image->FilledEllipses( $cx(pdl), $cy(pdl), $w(pdl), $h(pdl), $color(pdl) )

Alias for gdImageFilledEllipses β€” solid ellipses only, no hollow vibes here. πŸ“

gdImageFilledEllipses πŸ’–

$image->gdImageFilledEllipses( $cx(pdl), $cy(pdl), $w(pdl), $h(pdl), $color(pdl) )

Yep. It's giving filled ellipse. That's it, that's the function. πŸ‘‘


🫢 CLASS FUNCTIONS 🫢

Okay so these ones don't want an object, they want you to hand them the images directly. Class functions, main character energy, no $image-> chain. Let's go. πŸ’œ

gdImageCopy 🌸

gdImageCopy ( $dst(PDL::IO::GD), $src(PDL::IO::GD), $dstX, $dstY, $srcX, $srcY, $w, $h )

gdImageCopyMerge 🌈

gdImageCopyMerge ( $dst(PDL::IO::GD), $src(PDL::IO::GD), $dstX, $dstY, $srcX, $srcY, $w, $h, $pct )

gdImageCopyMergeGray πŸ’œ

gdImageCopyMergeGray ( $dst(PDL::IO::GD), $src(PDL::IO::GD), $dstX, $dstY, $srcX, $srcY, $w, $h, $pct )

gdImageCopyResized πŸŽ€

gdImageCopyResized ( $dst(PDL::IO::GD), $src(PDL::IO::GD), $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH )

gdImageCopyResampled ✨

gdImageCopyResampled ( $dst(PDL::IO::GD), $src(PDL::IO::GD), $dstX, $dstY, $srcX, $srcY, $dstW, $dstH, $srcW, $srcH )

gdImageCompare πŸ”₯

gdImageCompare ( $im1(PDL::IO::GD), $im2(PDL::IO::GD) )

Putting two images head to head, no cap. πŸ’…

gdImagePaletteCopy πŸ¦‹

gdImagePaletteCopy ( $dst(PDL::IO::GD), $src(PDL::IO::GD) )

StringTTF ⭐

$image->StringTTF( $brect, $fg, $fontlist, $ptsize, $angle, $x, $y, $string )

Alias for gdImageStringTTF. ✨

gdImageStringTTF πŸ’–

$image->gdImageStringTTF( $brect, $fg, $fontlist, $ptsize, $angle, $x, $y, $string )

StringFT 🌸

$image->StringFT( $brect, $fg, $fontlist, $ptsize, $angle, $x, $y, $string )

Alias for gdImageStringFT. Same signature, same everything, just a shorter name to type at 3am. 😭

gdImageStringFT πŸ’œ

$image->gdImageStringFT( $brect, $fg, $fontlist, $ptsize, $angle, $x, $y, $string )

πŸ‘‘ AUTHOR πŸ‘‘

Judd Taylor, Orbital Systems, Ltd. β€” judd dot t at orbitalsystems dot com 🫢


That's the whole page, bestie, we ate and left no crumbs 🍽️✨ This one's from perl v5.40.1, dated 2025-04-12, and it's the GD(3pm) page. Now go draw something iconic. πŸ’…πŸŒˆ

πŸ“¦ where this page comes from