Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jul 2011
    Location
    USA
    Posts
    39
    Thanks
    0
    Thanked 1 Time in 1 Post

    Help With Image::Magick

    Hi guys. I normally use the Imagick Class and php to do any imaging but I had a person request help in making an image countdown using cgi/perl. I found this simple script online and it writes the image ok, but I want to print out the image with an image header. I tried by adding a png header but to no avail. Also is there a parameter that says to make it a jpg, png, or gif?

    Code:
    #!/usr/bin/perl -w
    use Image::Magick;
    $q = Image::Magick->new();
    $q->Set(size => '200x80');
    $q->Read('xc:white');
    $q->Annotate( text => 'Hi There', font => '../../php/fonts/deloise.ttf', pointsize => 40, fill => 'black', gravity => 'Center', );
    $q->Write('whatever.png');
    Thanks for any help!

  • #2
    New Coder
    Join Date
    Jul 2011
    Location
    USA
    Posts
    39
    Thanks
    0
    Thanked 1 Time in 1 Post
    I found it:

    Code:
    print "Content-type: image/png\n\n";
    binmode STDOUT;
    $q->Write("png:-");
    undef $q;
    exit();
    So should look like this:

    Code:
    #!/usr/bin/perl -w
    use Image::Magick;
    $q = Image::Magick->new();
    $q->Set(size => '200x80');
    $q->Read('xc:white');
    $q->Annotate( text => 'Hi There', font => '../../php/fonts/deloise.ttf', pointsize => 40, fill => 'black', gravity => 'Center', );
    print "Content-type: image/png\n\n";
    binmode STDOUT;
    $q->Write("png:-");
    undef $q;
    exit();


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •