Upload solution to 11 from school
e v i l
This commit is contained in:
parent
4423e9dfce
commit
aaacf8184c
4 changed files with 17 additions and 0 deletions
17
python/pythonchallenge.com/11 - 5808.py
Normal file
17
python/pythonchallenge.com/11 - 5808.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
from PIL import Image
|
||||
|
||||
img = Image.open('cave.jpg')
|
||||
|
||||
even = Image.new('RGB', (img.width // 2, img.height // 2))
|
||||
odd = Image.new('RGB', (img.width // 2, img.height // 2))
|
||||
|
||||
for i in range(img.width):
|
||||
for j in range(img.height):
|
||||
p = img.getpixel((i, j))
|
||||
if (i + j) % 2 == 1:
|
||||
odd.putpixel((i // 2, j // 2), p)
|
||||
else:
|
||||
even.putpixel((i // 2, j // 2), p)
|
||||
|
||||
even.save('even.jpg')
|
||||
odd.save('odd.jpg') # evil
|
BIN
python/pythonchallenge.com/cave.jpg
Normal file
BIN
python/pythonchallenge.com/cave.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 125 KiB |
BIN
python/pythonchallenge.com/even.jpg
Normal file
BIN
python/pythonchallenge.com/even.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.6 KiB |
BIN
python/pythonchallenge.com/odd.jpg
Normal file
BIN
python/pythonchallenge.com/odd.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Loading…
Reference in a new issue