turning off antialiasing in imagettftext() does not work

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Leif Wessman

    turning off antialiasing in imagettftext() does not work


    From: http://www.php.net/manual/en/function.imagettftext.php
    "color is the color index. Using the negative of a color index has the
    effect of turning off antialiasing."

    I'm using a bundled version of GD: 2.0.23 compatible. When using the
    function imagettftext() with a negative color to get a aliased text as
    stated in the docs the text gets grainy. Not antialised, and not
    aliased. Something in between (ugly!). I've tried several fonts.
    What could be wrong?

    Leif

  • Leif Wessman

    #2
    Re: turning off antialiasing in imagettftext() does not work


    Leif Wessman wrote:[color=blue]
    > From: http://www.php.net/manual/en/function.imagettftext.php
    > "color is the color index. Using the negative of a color index has[/color]
    the[color=blue]
    > effect of turning off antialiasing."
    >
    > I'm using a bundled version of GD: 2.0.23 compatible. When using the
    > function imagettftext() with a negative color to get a aliased text[/color]
    as[color=blue]
    > stated in the docs the text gets grainy. Not antialised, and not
    > aliased. Something in between (ugly!). I've tried several fonts.
    > What could be wrong?
    >
    > Leif[/color]

    This is my code. As you can see there is nothing special about it:

    <?
    header("Content-type: " . image_type_to_m ime_type (IMAGETYPE_PNG) );
    $im = imagecreate(400 , 30);
    $white = imagecoloralloc ate($im, 255, 255, 255);
    $black = imagecoloralloc ate($im, 0, 0, 0);

    imagettftext($i m, 10, 0, 10, 20, -$black, "verdanab.t tf", "Testing...
    Omega");
    imagepng($im);
    imagedestroy($i m);
    ?>

    This is the output of the script:

    Webs.com has been shut down on the 31st of August 2023. Find out what that means for your site and how to move it to another provider.

    As you can see, the text is grainy.

    Comment

    • Shawn Wilson

      #3
      Re: turning off antialiasing in imagettftext() does not work


      Leif Wessman wrote:[color=blue]
      >
      > Leif Wessman wrote:[color=green]
      > > From: http://www.php.net/manual/en/function.imagettftext.php
      > > "color is the color index. Using the negative of a color index has[/color]
      > the[color=green]
      > > effect of turning off antialiasing."
      > >
      > > I'm using a bundled version of GD: 2.0.23 compatible. When using the
      > > function imagettftext() with a negative color to get a aliased text[/color]
      > as[color=green]
      > > stated in the docs the text gets grainy. Not antialised, and not
      > > aliased. Something in between (ugly!). I've tried several fonts.[/color][/color]
      [color=blue]
      > http://www.freewebs.com/leifwessman/test.png
      > As you can see, the text is grainy.[/color]

      It looks aliased to me... I think it just looks grainy because it's aliased and
      tiny. I think if you make it bigger, the aliasing will become apparent.

      Shawn
      --
      Shawn Wilson
      shawn@glassgian t.com

      Comment

      • Leif Wessman

        #4
        Re: turning off antialiasing in imagettftext() does not work


        Shawn Wilson wrote:[color=blue]
        > Leif Wessman wrote:[color=green]
        > >
        > > Leif Wessman wrote:[color=darkred]
        > > > From: http://www.php.net/manual/en/function.imagettftext.php
        > > > "color is the color index. Using the negative of a color index[/color][/color][/color]
        has[color=blue][color=green]
        > > the[color=darkred]
        > > > effect of turning off antialiasing."
        > > >
        > > > I'm using a bundled version of GD: 2.0.23 compatible. When using[/color][/color][/color]
        the[color=blue][color=green][color=darkred]
        > > > function imagettftext() with a negative color to get a aliased[/color][/color][/color]
        text[color=blue][color=green]
        > > as[color=darkred]
        > > > stated in the docs the text gets grainy. Not antialised, and not
        > > > aliased. Something in between (ugly!). I've tried several fonts.[/color][/color]
        >[color=green]
        > > http://www.freewebs.com/leifwessman/test.png
        > > As you can see, the text is grainy.[/color]
        >
        > It looks aliased to me... I think it just looks grainy because it's[/color]
        aliased and[color=blue]
        > tiny. I think if you make it bigger, the aliasing will become[/color]
        apparent.[color=blue]
        >
        > Shawn
        > --
        > Shawn Wilson
        > shawn@glassgian t.com
        > http://www.glassgiant.com[/color]


        I've tried making it bigger. I've tried different fonts. Same result.
        It shouldn't look that way... Something is wrong.

        Leif

        Comment

        Working...