Closed fish2000 closed 4 years ago
Hey I am not sure why the Python 3.4 test failed – it does look like it is a failure in the entropy code, but it seems to be related to the PIL.Image
type, qua a nose
mocking operation?… I couldn’t reproduce this error on my end, but if someone points me toward anything wrong, I’ll gladly fix it of course.
As of version 6.1.0, the Pillow imaging library’s C module includes an optimized native entropy method:
• https://github.com/python-pillow/Pillow/blob/master/CHANGES.rst#610-2019-07-01
This change detects and selects this new native method, if it is available in the version of Pillow upon which
pilkit
finds itself running.Additionally, an optimized version of the existing Python entropy method is furnished as a fallback: rather than summing the entire histogram value set, the function calculates the product of the image dimensions and band count to arrive at the same number. It also uses generator expressions and the specialized
math.fsum(…)
andmath.log2(…)
library calls to improve on the performance of its predecessor without altering the algorithm.The appropriate image-entropy function is then conditionally ensconced in the
pilkit.processors.utils
module, at module-load time.