GD text in existing image

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel van den Oord

    GD text in existing image

    I'm trying to put text in an existing image. I got this working with the
    following code.
    I need this because I am making a FAQ and want certain screenshots with auto
    filled in names
    I tried putting this lines in a working script though I get carbage on my
    screen now.. I think this is a result of a conflict between content-type:
    HTML/Text\n\n en binmode ?!?

    How can I overcome this ?!?
    #!/usr/bin/perl -w

    use GD;

    $im = newFromPng GD::Image("../../images/frontpage/circle.png");
    $black = $im->colorAllocate( 0,0,0);
    $im->string(gdSmall Font,2,10,"Test ing",$black);
    binmode STDOUT;
    print $im->png;


  • Joe Smith

    #2
    Re: GD text in existing image

    Daniel van den Oord wrote:
    [color=blue]
    > carbage... I think this is a result of a conflict between content-type:
    > HTML/Text\n\n en binmode ?!?[/color]

    You're supposed to output "Content-type: image/png\n\n"
    before setting STDOUT to binmode.
    -Joe

    Comment

    Working...