Hi all.

For the past week, I have been experimenting with the GD module and this evening I was trying to write white text on a black image. Creating the background was simple but writing text on to it has proven to be a perplexing task.
#!/usr/bin/perl -w use strict; use GD; use GD::Text; my $image = new GD::Image( 320, 160 ); my $black = $image->colorAllocate( 0, 0, 0 ); my $text = new GD::Text->new( $image, font => gdLargeFont, text => "Perl Coder", color => "white", valign => "top", halign => "center", ); $title->draw( IMAGE_SIZE / 2 TITLE_Y_COORD ); $image->filledRectangle( 15, 15, 150, 150, $black ); open( IMAGE, ">pc1.png") || die "Couldn't open file: $!\n"; binmode( IMAGE ); print IMAGE $image->png(); close IMAGE;


I am awaiting the publication of the following two books on the subject:

Thanks,
-Katie.

In reply to Creating an image with GD. by DigitalKitty

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.