Skip to content

Commit dfd08ca

Browse files
authored
Merge pull request #3 from Belgin-Android/main
Create Kernal_Filter_An_Image.py
2 parents 81bfd19 + 1c661b4 commit dfd08ca

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Kernal_Filter_An_Image.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Parameters:
2+
# size – Kernel size, given as (width, height). In the current version, this must be (3, 3) or (5, 5).
3+
# kernel – A sequence containing kernel weights.
4+
# scale – Scale factor. If given, the result for each pixel is divided by this value. the default is the sum of the kernel weights.
5+
# offset – Offset. If given, this value is added to the result, after it has been divided by the scale factor.
6+
7+
from PIL import Image, ImageFilter
8+
9+
# creating a image object
10+
orginal = Image.open(r"C:\Users\Belgin\Desktop\github.png")
11+
12+
# applying the Kernel filter
13+
kernal = orginal.filter(ImageFilter.Kernel((3, 3), (-1, -1, -1, -1, 11, -2, -2, -2, -2), 1, 0))
14+
15+
kernal = kernal.show()

0 commit comments

Comments
 (0)