pythonimagepython-imaging-libraryimagekitdjango-imagekit

Change saturation with Imagekit, PIL or Pillow?


How do I go about changing the saturation of an image using PIL or Pillow? Preferably I'd like to be able to use the solution together with the django-imagekit package. The reason I need to change the saturation is to create an effect where when the user hovers a black-and-white image it turns to colored.


Solution

  • If you're using django-imagekit, you can just use the bundled Adjust processor:

    from imagekit.processors import Adjust
    Adjust(color=0.5)
    

    Under the hood, this will do exactly what @abarnert recommended.