Brightening Or Darkening Images In Pil Without Built In Functions
I'm using PIL for a uni project and we have one task where we have to darken or brighten an image without using any of PIL's functions to do so. The function takes the original fil
Solution 1:
It's an issue of integer division in the (extent/100)
expression. To rectify this, you can:
use a floating point literal
extent/100.0
Handy if a term is a literal.
convert either the numerator or the denominator into float
float(extent)/a_hundred
If no term is a literal.
make sure that /
is floating-point division
from __future__ import division
Insert that at the beginning of your source file, like all __future__
statements.
invoke python with -Qnew
python -Qnew
If using python2, otherwise
use python3 :)
In all cases, //
remains integer division.
Post a Comment for "Brightening Or Darkening Images In Pil Without Built In Functions"