Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating image entropy implementations #529

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Nov 13, 2019

  1. Updating image entropy implementations

    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 `easy-thumbnails` finds itself running.
    
    Additionally, an optimized version of the existing Python image-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(…)` and `math.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 `easy_thumbnails.utils` module, at module-load time.
    
    I also made a slight tweak to the `pil_image` function, found in `easy_thumbnails.source_generators` – the call to `PIL.Image.Image.load()` was raising the exception noted in comments in that functions’ source while I was running the testsuite; now all such calls have these exceptions swallowed and everything works OK.
    fish2000 committed Nov 13, 2019
    Configuration menu
    Copy the full SHA
    a251149 View commit details
    Browse the repository at this point in the history

Commits on Dec 23, 2019

  1. Configuration menu
    Copy the full SHA
    501d73a View commit details
    Browse the repository at this point in the history