Bug #16544

GIFBUILDER ignores jpeg-quality

Added by Sebastian Lenz about 15 years ago. Updated over 8 years ago.

Should have
Target version:
Start date:
Due date:
% Done:


Estimated time:
TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


The TypoScript directive
GIFBUILDER.format = jpg
GIFBUILDER.quality = 50
has no effect on the quality of the rendered image as the function start($conf,$data) in class.tslib_gifbuilder.php doesn’t check the option "quality". The gifbuilder will always return a jpg-file with the quality set in the localconf.php, at least in the typo3-version 4.0 im currently running on.

In order to fix this problem I added the following line to start()

$this->jpegQuality =t3lib_div::intInRange($this->setup['quality'] * 1, 10, 100, $GLOBALS['TYPO3_CONF_VARS']['GFX']['jpg_quality']);

Later on I found an even better solution. As the gifbuilder creates several temporary files while processing an image and also stores them with the quality set in $jpegQuality, I changed the function start() to:

$this->jpegQuality = 100;
$this->jpegOutputQuality = t3lib_div::intInRange($this->setup['quality'] * 1, 10, 100, $GLOBALS['TYPO3_CONF_VARS']['GFX']['jpg_quality']);
$this->cmds['jpg'] = $this->cmds['jpeg'] = '-colorspace RGB -quality 100';

Later in the class, within the function gifBuild() I added the line
$this->jpegQuality = $this->jpegOutputQuality;

just before $this->output() is called. Doing this, image quality enhanced, as all the temporary files now are written with highest jpeg-compression.
(issue imported from #M4185)


Updated by Michael Stucki about 15 years ago

Bernhard, could you please have a look at this? Thanks!


Updated by Erwin Eggenberger almost 15 years ago


I had the same problem as Sebastian. I tried his fix, but it didn't work for GMENUs (all JPEGs are written with 100% quality), because the makeGifs() function in class.tslib_menu.php doesn't use the gifBuild() function but instead calls make() and output() itself.
When you move the line
$this->jpegQuality = $this->jpegOutputQuality;
from the gifBuild() function to the end of the make() function the quality parameter also works in GMENUs.


Updated by Stefan Geith over 9 years ago

  • Target version deleted (0)

Is this realy still not fixed ?


Updated by Alexander Opitz over 8 years ago

  • Category deleted (Communication)
  • Status changed from New to Closed
  • PHP Version deleted (4)

No feedback over one year => closed.

Also available in: Atom PDF