Make WordPress Core

Changeset 60669


Ignore:
Timestamp:
08/26/2025 09:03:16 PM (7 months ago)
Author:
adamsilverstein
Message:

Media: improve doc blocks for PNG handling in Imagick.

These changes were inadvertently omitted from [60667].

Props adamsilverstein.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-image-editor-imagick.php

    r60667 r60669  
    445445
    446446        try {
    447             /*
    448              * We need to perform some special handling for certain types of images:
     447            /**
     448             * Special handling for certain types of PNG images:
    449449             * 1. For PNG images, we need to specify compression settings and remove unneeded chunks.
    450450             * 2. For indexed PNG images, the number of colors must not exceed 256.
    451451             * 3. For indexed PNG images with an alpha channel, the tRNS chunk must be preserved.
    452              * 4. For indexed PNG images with true alpha transparency (an alpha channel > 1 bit),
    453              *    we need to avoid saving the image using ImageMagick's 'png8' format,
    454              *    because that supports only binary (1 bit) transparency.
     452             * 4. For indexed PNG images with true alpha transparency (an alpha channel > 1 bit), we need to avoid saving
     453             * the image using ImageMagick's 'png8' format,  because that supports only binary (1 bit) transparency.
    455454             *
    456              * For #4 we want to check whether the image has a 1-bit alpha channel before resizing,
    457              * because resizing may cause the number of alpha values to multiply due to antialiasing.
    458              * (We're assuming that, if the original image had only a 1-bit alpha channel,
    459              * then a 1-bit alpha channel should be good enough for the resized images too.)
    460              * So we're going to perform all the necessary checks before resizing the image
    461              * and store the results in variables for later use.
     455             * For #4 we want to check whether the image has a 1-bit alpha channel before resizing,  because resizing
     456             * may cause the number of alpha values to multiply due to antialiasing. If the original image had only a
     457             * 1-bit alpha channel, then a 1-bit alpha channel should be good enough for the resized images.
     458             *
     459             * Perform all the necessary checks before resizing the image and store the results in variables for later use.
    462460             */
    463461            $is_png                                      = false;
Note: See TracChangeset for help on using the changeset viewer.