65088[BUGFIX] Apply quality constraint to processed images only once
Commit message
Review
-
Code review CR 0
-
Verified V 0
Issues 1
Files 1
Review log 1520
-
Andreas Kienast uploaded patch set 1 07/25/20, 07:40
-
TYPO3com voted on patch set 1 V -1 07/25/20, 07:41 Completed build in 20s on Sat, 25 Jul, 07:41 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4233
-
Andreas Kienast updated the commit message in patch set 2 07/25/20, 07:41
-
TYPO3com voted on patch set 2 V -1 07/25/20, 07:42 Completed build in 20s on Sat, 25 Jul, 07:42 AM Test Summary: No tests found Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4234
-
Andreas Kienast uploaded patch set 3 07/25/20, 07:42
-
Andreas Kienast updated the commit message in patch set 4 07/25/20, 07:44
-
Anja Leichsenring updated the commit message in patch set 5 07/25/20, 07:48
-
TYPO3com voted on patch set 3 V +1 07/25/20, 07:55 Completed build in 12m 50s on Sat, 25 Jul, 07:55 AM Test Summary: 72921 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4235
-
TYPO3com voted on patch set 4 V +1 07/25/20, 07:58 Completed build in 13m 57s on Sat, 25 Jul, 07:58 AM Test Summary: 72921 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4236
-
TYPO3com voted on patch set 5 V +1 07/25/20, 08:02 Completed build in 13m 23s on Sat, 25 Jul, 08:02 AM Test Summary: 72921 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-4237
-
Christian Toffolo commented on patch set 5 07/26/20, 11:27
-
Helmut Hummel commented on patch set 5 CR -1 07/26/20, 14:36
What happens, if there is NO further processing of the image?LocalCropScaleMaskHelper.php:92Reply UnresolvedMore importantly: removing this option here results in quality definition not applied any more at all, when no further processing is applied -
Andreas Kienast commented on patch set 5 07/26/20, 17:49
Reply
If I read the code correctly, this is the case if we handle SVGs (which don't get converted) or when generating masks that don't base on FAL assets. How likely is it this will happen and how would we make this more predictable? -
Helmut Hummel commented on patch set 5 07/27/20, 11:40
Reply
One thing that is a bit tricky here indeed is "reading the code correctly". What I see at least, is, that this class does only handle assets based on FAL, as the incoming argument is a Task. To fix this issue, I'd argue we'd need to do a bit more than just removing the quality constraint from one call, but rather (re-)conceptualize demands and expected outcome for different scenarios and then apply this concept to the code. I argue like that, because this issue and the attempt to fix it raises a couple of questions, that aren't easy to answer without doing a conceptual step: 1. Should the default quality of 92% be used or rather 100% in the first processing? 2. Is there a case where the cropped image isn't processed any further, leading to be stuck with the initial quality? 3. Does the double processing cause quality loss even with higher quality in the first step and can we probably apply all processing in one step instead? 4. What other types of processing happen (or not happen when svg) and does how are they affected? Looking into GraphicalFunctions::imageMagickConvert e.g. indeed reveals that a crop might be applied again, when provided with width and height options. So this would be the appropriate place to fix, although much more complicated of course. Last but not least, here one example that would cause another bug, when applying this change proposal (based on my understanding of the current code): An image has crop instructions, but no other processing instructions. Then the second call to imageMagickConvert will return early without any additional processing being applied, resulting in a final image with 100% quality, which I think isn't the desired outcome. -
Helmut Hummel commented on patch set 5 V -1 07/28/20, 12:56
> Last but not least, here one example that would cause another bug, when applying this change proposal (based on my understanding of the current code): I debugged my way through the code using the given example. Code path is indeed like predicted. Processing happens only once when only a crop instruction is present, leading to an resulting image that hasn't the configured quality. -
Helmut Hummel commented on patch set 5 07/29/20, 12:22
Found this https://review.typo3.org/c/Packages/TYPO3.CMS/+/56779/, which explixitly introduced the quality option -
Christian Toffolo commented on patch set 5 07/30/20, 10:46
Reply Unresolved
I answer here what I can after having debugged the code... 1. If you can choose the quality for a temporary JPG image why you should even consider a quality < 100? 2. Debugging the code I can't find a case where the eventually cropped image (first time JPG compressed image) isn't compressed again. Both masked and not masked will pass again into imageMagickConvert 3. A 100% quality JPG practically doesn't change the pixels of the image, at least not in a human perceivable way. Try comparing an original image with its 100% JPG conversion, max zooming in, there's no difference at pixels level. 4. in case of a cropped SVG a tmp PNG is used instead of JPG so no problem because PNG is lossless. -
Christian Toffolo commented on patch set 5 07/30/20, 10:51
> Patch Set 5: Verified-1 > > > Last but not least, here one example that would cause another bug, when applying this change proposal (based on my understanding of the current code): > > I debugged my way through the code using the given example. Code path is indeed like predicted. Processing happens only once when only a crop instruction is present, leading to an resulting image that hasn't the configured quality. Please, can you give me some direction to reproduce this case? Because of what I tried, the JPG cropped image always is passed to imageMagickConvert after. -
Helmut Hummel commented on patch set 5 CR -2 08/05/20, 11:24
Let's continue here: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65187 -
Helmut Hummel abandoned the change 08/05/20, 11:25
Alternative solution: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65187
LocalCropScaleMaskHelper.php:92