diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..19cb9f1
Binary files /dev/null and b/.DS_Store differ
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..d56657a
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..d1160c6
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/refactoring.iml b/.idea/refactoring.iml
new file mode 100644
index 0000000..d0876a7
--- /dev/null
+++ b/.idea/refactoring.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/filter.py b/filter.py
index 4150df2..480fe43 100644
--- a/filter.py
+++ b/filter.py
@@ -1,28 +1,25 @@
-from PIL import Image
import numpy as np
-img = Image.open("img2.jpg")
+from PIL import Image
+
+input_file = input()
+outpit_file = input()
+img = Image.open(input_file)
arr = np.array(img)
-a = len(arr)
-a1 = len(arr[1])
+height = len(arr)
+width = len(arr[1])
+mosaic_size = 10;
+grayscale = 50;
+
i = 0
-while i < a - 11:
+while i < height:
j = 0
- while j < a1 - 11:
- s = 0
- for n in range(i, i + 10):
- for n1 in range(j, j + 10):
- n1 = arr[n][n1][0]
- n2 = arr[n][n1][1]
- n3 = arr[n][n1][2]
- M = n1 + n2 + n3
- s += M
- s = int(s // 100)
- for n in range(i, i + 10):
- for n1 in range(j, j + 10):
- arr[n][n1][0] = int(s // 50) * 50
- arr[n][n1][1] = int(s // 50) * 50
- arr[n][n1][2] = int(s // 50) * 50
- j = j + 10
- i = i + 10
+ while j < width:
+ pixel = arr[i: i + mosaic_size, j: j + mosaic_size]
+ pixel_color = (pixel.sum() / 3) // (100 * grayscale) * grayscale
+ new_pixel = np.full(300, pixel_color).reshape(10, 10, 3)
+ arr[i: i + mosaic_size, j: j + mosaic_size] = new_pixel
+ j = j + mosaic_size
+ i = i + mosaic_size
+
res = Image.fromarray(arr)
-res.save('res.jpg')
+res.save(outpit_file)
diff --git a/res.jpg b/res.jpg
index d8d97ff..69c781c 100644
Binary files a/res.jpg and b/res.jpg differ