Re: [GD-DEVEL] trasparent image width antialiasing
[email protected] ("yagyog")
| Newsgroups | php.gd.devel |
|---|---|
| Message-ID | <005101c74aa3$7b2a4180$c9113d52@desktop> |
----- Original Message ----- From: "yagyog" <[email protected]> To: "Pierre" <[email protected]> Cc: <[email protected]> Sent: Thursday, February 01, 2007 5:06 PM Subject: Re: [GD-DEVEL] trasparent image width antialiasing > ----- Original Message ----- > From: "Pierre" <[email protected]> > To: "yagyog" <[email protected]> > Cc: <[email protected]> > 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