Skip to content
Advertisement

Change contrast and sharpness of a Picture in Python

I’m new to coding, some my code isn’t the cleanest (as evidenced below). Is there a more efficent way to change both the sharpness and contrast with Pillow in python without having to save and open the file twice?

My horrible code:

JavaScript

Advertisement

Answer

You can do it without saving to disk like this:

JavaScript

Transforms this:

enter image description here

into this:

enter image description here

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement