Commit bbe161cc authored by Benni Mack's avatar Benni Mack Committed by Georg Ringer
Browse files

[!!!][TASK] Remove option to generate PNGs limited to 64 colors

The global configuration "png_truecolor" which ensured that generated PNG
images only have 64 colors (instead of the max colors) came from the transition
12 years ago to keep a small file size for PNG images.

The option was turned on for new installations and existing installations,
and if not explicitly disabled, generated true-color PNG images at any time.

The option did not have any effect for FAL-related image resizing at all.

In order to generate PNGs with a limited color-space, it is still possible to do so with
additional "reduceColors" option, as well as adding additional parameters to
ImageMagick when needed.

However, having a global option for this feature seems to be not practical these
days anymore.

Resolves: #82680
Releases: master
Change-Id: I3e00cc1c37a5ed8287dcf7cad49d2a2ab10730e6
Reviewed-on: https://review.typo3.org/54277

Reviewed-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez's avatarAndreas Fernandez <typo3@scripting-base.de>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer's avatarGeorg Ringer <georg.ringer@gmail.com>
parent 8fb35438
......@@ -51,13 +51,6 @@ class GraphicalFunctions
*/
public $gdlibExtensions = '';
/**
* Set to TRUE if generated png's should be truecolor by default
*
* @var bool
*/
public $png_truecolor = false;
/**
* defines the RGB colorspace to use
*
......@@ -133,7 +126,7 @@ class GraphicalFunctions
'jpg' => '',
'jpeg' => '',
'gif' => '',
'png' => '-colors 64'
'png' => ''
];
/**
......@@ -329,9 +322,6 @@ class GraphicalFunctions
if (function_exists('imagecreatefromgif') && function_exists('imagegif')) {
$this->gdlibExtensions .= ',gif';
}
if ($gfxConf['png_truecolor']) {
$this->png_truecolor = true;
}
if ($gfxConf['processor_colorspace'] && in_array($gfxConf['processor_colorspace'], $this->allowedColorSpaceNames, true)) {
$this->colorspace = $gfxConf['processor_colorspace'];
......@@ -340,11 +330,6 @@ class GraphicalFunctions
if (!$gfxConf['processor_enabled']) {
$this->NO_IMAGE_MAGICK = 1;
}
// When GIFBUILDER gets used in truecolor mode
// No colors parameter if we generate truecolor images.
if ($this->png_truecolor) {
$this->cmds['png'] = '';
}
// Setting default JPG parameters:
$this->jpegQuality = MathUtility::forceIntegerInRange($gfxConf['jpg_quality'], 10, 100, 85);
$this->addFrameSelection = (bool)$gfxConf['processor_allowFrameSelection'];
......@@ -2686,11 +2671,10 @@ class GraphicalFunctions
$ext = strtolower($reg[0]);
switch ($ext) {
case 'gif':
case 'png':
if ($this->ImageWrite($this->im, $file)) {
// ImageMagick operations
if ($this->setup['reduceColors'] || !$this->png_truecolor) {
if ($this->setup['reduceColors']) {
$reduced = $this->IMreduceColors($file, MathUtility::forceIntegerInRange($this->setup['reduceColors'], 256, $this->truecolorColors, 256));
if ($reduced) {
@copy($reduced, $file);
......@@ -2703,7 +2687,6 @@ class GraphicalFunctions
}
break;
case 'jpg':
case 'jpeg':
// Use the default
$quality = 0;
......
......@@ -38,7 +38,6 @@ return [
'processor_stripColorProfileCommand' => '+profile \'*\'',
'processor_colorspace' => 'RGB',
'jpg_quality' => 85,
'png_truecolor' => true,
],
'SYS' => [
// System related concerning both frontend and backend.
......
......@@ -62,9 +62,6 @@ GFX:
jpg_quality:
type: int
description: 'Integer: Default JPEG generation quality'
png_truecolor:
type: bool
description: 'When creating png images, always use the full colorpalette, if disabled could reduce file sizes for scaled images, but the image quality will be let down.'
SYS:
type: container
items:
......
.. include:: ../../Includes.txt
=======================================================================
Breaking: #82680 - Removed option to generate PNGs limited to 64 colors
=======================================================================
See :issue:`82680`
Description
===========
The option to generate PNGs with only 64 colors called :php:`$TYPO3_CONF_VARS[GFX][png_truecolor]` has been removed.
The public PHP property `GraphicalFunctions->png_truecolor` has been removed.
Impact
======
Setting the option has no effect anymore, as resized PNG images are always truecolor.
Affected Installations
======================
Any installation having this option disabled.
Migration
=========
Accessing the Install Tool removes the option. If necessary, the option can be set via TypoScript GIFBUILDER `reduceColors`.
.. index:: LocalConfiguration, PHP-API, NotScanned
\ No newline at end of file
......@@ -378,7 +378,7 @@ class GifBuilder extends GraphicalFunctions
$this->w = $XY[0];
$this->h = $XY[1];
// Transparent layer as background if set and requirements are met
if (!empty($this->setup['backColor']) && $this->setup['backColor'] === 'transparent' && $this->png_truecolor && !$this->setup['reduceColors'] && (empty($this->setup['format']) || $this->setup['format'] === 'png')) {
if (!empty($this->setup['backColor']) && $this->setup['backColor'] === 'transparent' && !$this->setup['reduceColors'] && (empty($this->setup['format']) || $this->setup['format'] === 'png')) {
// Set transparency properties
imagesavealpha($this->im, true);
// Fill with a transparent background
......
......@@ -116,6 +116,8 @@ class SilentConfigurationUpgradeService
'SC_OPTIONS/t3lib/class.t3lib_userauth.php/writeDevLogFE',
// #82438
'SYS/enableDeprecationLog',
// #82680
'GFX/png_truecolor',
];
public function __construct(ConfigurationManager $configurationManager = null)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment