Image-Base-GD
view release on metacpan or search on metacpan
devel/exe-misc.c view on Meta::CPAN
im = gdImageCreate (20, 10);
black = gdImageColorAllocate(im, 0, 0, 0);
white = gdImageColorAllocate(im, 255, 255, 255);
gdImageFilledRectangle(im, 0,0, 19,9, black);
gdImageRectangle(im, 5,5, 15,5, white);
fp = fopen("/tmp/x.png", "wb");
if (fp == NULL) abort();
gdImagePng(im, fp);
if (ferror(fp)) abort();
if (fclose(fp) != 0) abort();
system ("convert -monochrome /tmp/x.png /tmp/x.xpm && cat /tmp/x.xpm");
exit(0);
}
lib/Image/Base/GD.pm view on Meta::CPAN
And read-only,
xpm with libXpm
xbm
PNG, JPEG and XPM are available if libgd is compiled with the respective
support libraries. GIF will be unavailable if the Perl C<GD> interface was
built with its option to disable GIF.
C<load()> auto-detects the file format and calls the corresponding
C<newFromPng()> etc. "gd" file format differs between libgd 1.x and 2.x.
libgd 2.x could load the 1.x format, but always wrote 2.x so that's what
C<save()> here gives. Both "gd" formats were a byte dump mainly intended
for temporary files but are unsupported in current libgd.
WBMP is a bitmap format and is treated by GD as colours black "#000000" for
0 and white "#FFFFFF" for 1. On save, any non-black is treated as white 1
too, but not sure that's a documented feature.
=head2 Other GD Modules
( run in 0.553 second using v1.01-cache-2.11-cpan-0a6323c29d9 )