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