[!!!][TASK] Remove option to generate PNGs limited to 64 colors 77/54277/4
authorBenni Mack <benni@typo3.org>
Wed, 4 Oct 2017 05:17:10 +0000 (07:17 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 5 Oct 2017 16:21:34 +0000 (18:21 +0200)
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 <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/core/Classes/Imaging/GraphicalFunctions.php
typo3/sysext/core/Configuration/DefaultConfiguration.php
typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml
typo3/sysext/core/Documentation/Changelog/master/Breaking-82680-RemovedOptionToGeneratePNGsLimitedTo64Colors.rst [new file with mode: 0644]
typo3/sysext/frontend/Classes/Imaging/GifBuilder.php
typo3/sysext/install/Classes/Service/SilentConfigurationUpgradeService.php

index 3fe24a9..ae0391d 100644 (file)
@@ -52,13 +52,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
      *
      * @var string
@@ -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;
index f182214..4f5ee07 100644 (file)
@@ -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.
index db02442..d1b449b 100644 (file)
@@ -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:
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-82680-RemovedOptionToGeneratePNGsLimitedTo64Colors.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-82680-RemovedOptionToGeneratePNGsLimitedTo64Colors.rst
new file mode 100644 (file)
index 0000000..dec1aa4
--- /dev/null
@@ -0,0 +1,34 @@
+.. 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
index 1fc8670..abd3cb3 100644 (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
index 421c278..ad0bbee 100644 (file)
@@ -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)