Everybody! This is important. In a few days, these forums will be moving over to using the totally sweet Discourse platform. To ensure this migration happens smoothly with no loss of content, these forums are currently in a read-only mode. I do apologize for the inconvenience.

There is never a good time to turn the forums off for an extended period of time, but I promise the new forums will be a billion times better. I'm pretty sure of it.

See you all on the other side in a few days, and if you have any (non-technical) questions, please e-mail me at kirupa@kirupa.com. For technical questions, try to find a tutorial that corresponds to what you are looking for and post in the comments section of that page.

Cheers,
Kirupa

Results 1 to 3 of 3

Thread: GD Alpha Text Outline

  1. #1

    GD Alpha Text Outline

    Just playing with another ugly layout and i want to use Avenir with GD to create text with an alpha background, that is all accomplished. However, there is an ugly, jaggy white single pixel outline that looks like a bag of crap.

    Any idea how to get GD to anti alias, or at least not put out that white?

    Heres a link to what i'm working on:
    http://joshuajonah.com/joshuajonahv11/

    And here's the GD that i'm using to make the image(s). (it's also making the subtitles):
    PHP Code:
    <?php
    $text 
    $_GET['title'];
    $fontsize 60;
    $height 90;
    $font 'avenirheavy.otf';
    if(isset(
    $_GET['subtitle']) && $_GET['subtitle'] == "true"){
        
    $fontsize 30;
        
    $height 50;
        
    $font 'avenir.otf';
    }
    $size imagettfbbox($fontsize0$font$text);
    $width $size[2] + $size[0]-50;
    $im imagecreatetruecolor($width$height);
    if(isset(
    $_GET['subtitle']) && $_GET['subtitle'] == "true"){
        
    $white imagecolorallocate($im131313);
        
    $black imagecolorallocate($im255255255);
    }else{
        
    $white imagecolorallocate($im255255255);
        
    $black imagecolorallocate($im131313);
    }
    imagefilledrectangle$im00$width$height$white );
    $im2 imagecolortransparent($im$white);
    $xcoord = -10;
    $ycoord $height 3;
    $array str_split($text);
    $hpos 0;
    for(
    $i=0$i<count($array); $i++){
        if(isset(
    $_GET['subtitle']) && $_GET['subtitle'] == "true"){
            
    $bbox imagettftext$im$fontsize0$hpos$ycoord-12$black$font$array[$i] );
            
    $hpos $bbox[2];
        }else{
            
    $bbox imagettftext$im$fontsize0$hpos$ycoord$black$font$array[$i] );
            
    $hpos $bbox[2]-5;
        }
    }
    $fileparts split("[.?]",$text);
    $filename="";
    for(
    $i=0;$i<count($fileparts);$i++){
        
    $filename.=$fileparts[$i];
    };
    imagepng($im"../img/".$filename.".png");
    imagedestroy($im);
    echo 
    "img/".$filename.".png";
    ?>


    member #1 of the "XML-is-a-crutch-to-make-people-feel-elite-club"
    K-Emmys-06: Best Quote K-Emmys-06: Flash Genious

  2. #2
    nothin?


    member #1 of the "XML-is-a-crutch-to-make-people-feel-elite-club"
    K-Emmys-06: Best Quote K-Emmys-06: Flash Genious

  3. #3
    well, good news (I hope)

    I was looking at a site evildrummer sent me to learn about the basics of GD and I think I am correct in saying this could help your antialias

    http://nyphp.org/content/presentations/GDintro/gd22.php
    My Photography
    Twitter

    K-Emmys-06: Best "Newbie"

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012