[TYPO3-english] Gifbuilder + PNG transparency

Jigal van Hemert jigal at xs4all.nl
Sat Jul 23 20:15:03 CEST 2011


Hi,

On 22-7-2011 15:26, Michel Georgy - 4eyes GmbH wrote:
> I have some troubles with creating a PNG Image with Gifbuilder which
> has transparent parts. It's not a 0/1 transperency, so Gifbuilder
> creates some ugly black edges instead of a smooth transition from
> transparent to the object.
[...]
>    file = GIFBUILDER
>    file {
>      10 = IMAGE
>      20 = TEXT
>      30<  .20
>    }

For rendering the text parts Gifbuilder uses PHP functions. To combine 
the images it will most likely also use PHP functions (GD2). The problem 
here is that the PHP functions have very poor support for transparency.
I already invested some hours into finding a solution which could 
support alpha channel transparency in PNGs, but there is no way to let 
the PHP functions do that. They either take the transparency of both 
both images into account and generate an image without any transparency 
at all, or keep the transparency (alpha) channel of only one of the images.
The only way to keep a correct combined alpha channel would be to 
combine images pixel by pixel in the code, but this results in very slow 
rendering.

The chances of finding a way which results in a correct alpha channel 
are very small.

I would start with disabling niceText in the TEXT object. It was 
designed as a way to create some form of anti-aliasing if Freetype would 
not create any anti-aliasing. If a TrueType font doesn't render nicely 
with Freetype (which is used in PHP in the GDlibrary for rendering text) 
chances are that the Type1 version will work better.

-- 
Kind regards / met vriendelijke groet,

Jigal van Hemert.


More information about the TYPO3-english mailing list