We are messing aroung the PIL module and here is another sneack tip about it. Very neat, very simple, very effective... Ho to use ImageFilter.
As usual, let's import the modules we need. As I use the jupyter notebook, I will import also the display function, right?
from PIL import Image, ImageFilter from IPython.display import display
Now I am gonna to open my file image:
im = Image.open("img/dices.png")
Then I will apply the filter
im = im.filter(ImageFilter.FIND_EDGES)
Some lines to show the before and after pics... and that's all...
The whole code
from PIL import Image, ImageFilter from IPython.display import display im = Image.open("img/dices.png") display(im) im = im.filter(ImageFilter.FIND_EDGES) display(im)
Go here to see the notebook
Read the notebook
Comments
Post a Comment