Enforce specific PNG compression level of 9 #1684
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description (*)
Currently, Magento calculates the compression level for PNG images based on the desired image quality. For higher image qualities the compresseion is lowered or even disabled completely. This doesn't makes sense because PNG compression is lossless. Higher compression levels don't degrade image quality. Even worse, for the default quality of 90 a compression level of 1 is calculated. This is the lowest possible compression. If you increase the quality to 95, a compression level of 0 is calculated which disables PNG compression completely.
My pull request changes that so PNG compression is not calculated from image quality anymore. Instead, PNG compression is now defined in system configuration. As default value I set 9 (highest possible compression) because images are usually only resized compressed once and then cached on disk.
Manual testing scenarios (*)
Assign a PNG image as a product image. Change the image quality in Mage_Catalog_Model_Product_Image and look how the file size of the resized image changes.
Contribution checklist (*)