Skip to content

Commit ea812ad

Browse files
Media: improve doc blocks for PNG handling in Imagick.
These changes were inadvertently omitted from [60667]. Props adamsilverstein. git-svn-id: https://develop.svn.wordpress.org/trunk@60669 602fd350-edb4-49c9-b593-d223f7449a82
1 parent f77bcfa commit ea812ad

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/wp-includes/class-wp-image-editor-imagick.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -444,21 +444,19 @@ protected function thumbnail_image( $dst_w, $dst_h, $filter_name = 'FILTER_TRIAN
444444
}
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.
454+
*
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.
455458
*
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.
459+
* Perform all the necessary checks before resizing the image and store the results in variables for later use.
462460
*/
463461
$is_png = false;
464462
$is_indexed_png = false;

0 commit comments

Comments
 (0)