Re: [GD-DEVEL] trasparent image width antialiasing

From: Date: Wed, 07 Feb 2007 10:34:00 +0000
Subject: Re: [GD-DEVEL] trasparent image width antialiasing
References: 1 2 3 4 5 6 7 8 9 10 11 12  Groups: php.gd.devel 
Request: Send a blank email to php-gd-devel+get-71@lists.php.net to get a copy of this message
----- Original Message ----- From: "yagyog" <yagyog@tiscali.it> To: "Pierre" <pierre.php@gmail.com> Cc: <gd-devel@lists.php.net> Sent: Thursday, February 01, 2007 5:06 PM Subject: Re: [GD-DEVEL] trasparent image width antialiasing
----- Original Message ----- From: "Pierre" <pierre.php@gmail.com> To: "yagyog" <yagyog@tiscali.it> Cc: <gd-devel@lists.php.net> Sent: Thursday, February 01, 2007 4:04 PM Subject: Re: [GD-DEVEL] trasparent image width antialiasing [cut] These images are not correct. There is no alpha used in the text and the green/red "backgournd "colors are still used. You have to create images _without_ background color and only use _alpha_ for the text anti aliasing.
my result http://www.yag.altervista.org/varius/1/test.png
Yes, and it is expected, you have green and red artifacts.
And this http://www.yag.altervista.org/varius/1/T1.png
Yes, this one is correct.
well therefore with an image of this type as I can make? I add: and if my image instead is flat but with the witnesses with antialing I cannot just make nothing? I try this code
int remove_background(gdImagePtr im1, int color1, int color2, gdImagePtr im2,gdImagePtr im_out) { float alpha=0.0; int alphaBlend,pxTemp; int x, y,fx,fy,btl, btr, bbl, bbr; int alphaColor,calcAlpha; alphaBlend = 100; for(int i=0;i<(gdImageSX(im1));i++) for(int j=0;j<(gdImageSY(im1));j++) {
       //alphaBlend= gdAlphaBlend (color2,pxTemp);
       alphaColor = gdTrueColorAlpha(
                    gdTrueColorGetRed(pxTemp),
                    gdTrueColorGetGreen(pxTemp),
                    gdTrueColorGetBlue(pxTemp),
                    calcAlpha
                    );
       alphaColor = alphaBlend * gdImageGetTrueColorPixel (im1, i, j) + (1 - alphaBlend) *     gdImageGetTrueColorPixel (im2, i, j);
       gdImageSetPixel (im_out, i, j, alphaColor);
} gdImageColorTransparent (im_out, color1); gdImageSaveAlpha (im_out, 1); mySavePng ("test.png", im_out); return 1; } the formula is: http://en.wikipedia.org/wiki/Alpha_blending tnks

« previous php.gd.devel (#71) next »