[TYPO3-dev] kb_allcolors + gm

S. Teuber traveler_in_time at gmx.net
Mon Mar 13 09:59:01 CET 2006


Hi Bernhard,

sorry for the delayed answer, I needed a free time slot to prepare 
detailed descriptions and screenshots.

For the developer in a hurry, one conclusion of this posting is:

- the hardcoded setting in t3lib/config_default.php that sets 
im_negate_mask to a hardcoded value if graphics magick is used needs to 
be configurable to avoid problems with kb_allcolors (see [1] below)


>> cleared every imaginable location - FE cache, BE cache, cached image
>> sizes browser cache and typo3temp-files - the problem in the Frontend
>> still persisted. 
> 
> remove files in
> 
> typo3temp/GB/* (GIFBUILDER results)
> typo3temp/menu/* (GMENU results)

I did that before I wrote my initial posting... ;-)
Did it again now. Removed the files (from bash) to make sure *all* of 
them are gone. To no avail.

Note: Although not stated, I cleared all cache and files after every step 
taken from here.

 
> and tell me if it works and which variable you changed to what ....

I provided some screenshots.
http://www.stibes.de/gifbuilder/

The first shows how the frontend is supposed to look (and how it looks 
right now without kb_allcolors). On the second shot you can see the 
result of "Combining images" in the install tool. Everything is fine, 
except that the topbanner obviously has to few colors (you can see 
artefacts on it).

The next two screens show the same pages after the installation of 
kb_allcolors and the clearing of all caches & typo3temp. As you can see, 
the masks are inverted, leading to a corrupt output of all GIFBUILDER 
images in the frontend.

Note the additional line in the install tool

gm convert -colorspace GRAY +matte 
/path/typo3/sysext/install/imgs/blackwhite_mask.gif 
/path/typo3temp/temp/55449f907059a89c0eb9b06bb29c2765.gif

I checked both of the images, both are white in the upper half, black in 
the lower. So it's not the mask itself that's wrong, but its application.

Configuration at this point:

ImageMagick enabled: 1
ImageMagick path: /usr/local/bin/ ()
ImageMagick path/LZW: /usr/local/bin/ ()
Version 5 flag: gm

GDLib enabled: 1
GDLib using PNG: 0
GDLib 2 enabled: 1
IM5 effects enabled: -1 (Blurring/Sharpening with IM 5+)
Freetype DPI: 96 (Should be 96 for Freetype 2)
Mask invert: 1 (Should be set for some IM versions approx. 5.4+)


Due to the hardcoded if-Statement in t3lib/config_default.php (showed in 
my last posting), there's no way to invert the mask using the Install 
Tool -> All configuration, neither can it be done with localconf.php.

By commenting line 301 in t3lib/config_default.php:

[300] if ($GLOBALS['TYPO3_CONF_VARS']['GFX']['im_imvMaskState'])	{
[301] //	$GLOBALS['TYPO3_CONF_VARS']['GFX']['im_negate_mask']=$GLOBALS
['TYPO3_CONF_VARS']['GFX']['im_negate_mask']?0:1;
[302] }

I got the output in the Install Tool right (see screenshot 5).

In the frontend, the headlines and the top navigation are displayed 
correct now, but there's still a problem with the topbanner (screenshot 
6).

[1] So, to solve a general "mask inversion" problem, we need to fix the 
issue in t3lib/config_default.php and make the im_negate_mask 
configurable even if graphics magick is used instead of Image Magick.

Now what's wrong with the top banner? It's nothing special there, just a 
JPG that's fetched from levelmedia with a half-transparent logo and a 
dotted line applied:

------------------- TS code for topbanner ---------------------------
// Atmobild (aus page:media)
temp.topbanner = IMAGE
temp.topbanner {
    file = GIFBUILDER
    file {
        XY = 990,100
        format = jpg
        quality = 85

        10 = IMAGE
        10.file {
            import.data = levelmedia: -1, slide
            import = uploads/media/
            import.listNum = 0
        }

        20 = IMAGE
        20 {
            file = {$const.dir.media}/reiter/dotted.gif
            offset = 0,99
        }

        30 = IMAGE
        30 {
            file = {$const.dir.media}/hhulogo.gif
            offset = 19,5
            mask = GIFBUILDER
            mask {
                XY = 150,62
                backColor = #CCCCCC
            }
        }
    }
    stdWrap.typolink.parameter = www.uni-duesseldorf.de

}
---------------------- end of TS code -------------------

To reduce complexity, I stripped it down to this:

// Atmobild (aus page:media)
temp.topbanner = IMAGE
temp.topbanner {
    file = GIFBUILDER
    file {
        XY = 990,100
        format = jpg
        quality = 85

        10 = IMAGE
        10.file {
            import.data = levelmedia: -1, slide
            import = uploads/media/
            import.listNum = 0
        }
    }
}

- still no image is being displayed!
Well, wtf? Next, I commented out the line "format = jpg".

Guess what. The image appears! But, of course, as a GIF having 256 colors 
- that's exactly why I installed kb_allcolors in the first place, to get 
*more* colors on that image. ;-)

See screenshot 7.

On this screenshot, you can see another problem. Take a look at the top 
navigation (the blue thing labeled "Philosophische Fakultät"). Obviously, 
it lacks it's transparency! Compare it to screenshot 1 to see what I 
mean.

So, using kb_allcolors with graphics magick, even after solving the 
inverted-mask-issue by patching a core file, leaves two problems:

- I cannot generate jpg, only GIF, which leaves me with 256 colors anyway
  (Note: I tried to set "format = jp*e*g" later, didn't work)

- The transparency on my GIFs is gone!



> and also GM version and gdlib + php version :)

GM 1.1.6
PHP 4.3.10
GD bundled (2.0.28 compatible)

running on Debian Sarge with freetype 2.

Any ideas how to solve the problems regarding JPG output and GIF 
transparency?

Thanks for your attention,

Sven





More information about the TYPO3-dev mailing list