Skip to content

Commit c29e080

Browse files
authored
This is a combine knowledge on manipulation of image using PIL.
1 parent d331afd commit c29e080

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

Assignement1.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import PIL
2+
from PIL import Image, ImageEnhance, ImageFilter
3+
from IPython.display import display
4+
file = "basic.jpg"
5+
img = Image.open(file).convert("RGB")
6+
7+
images=[]
8+
for shade in range(10,1,-4):
9+
layer = Image.new('RGB', img.size, color=(0,255,255))
10+
output = Image.blend(img, layer, shade/30)
11+
images.append(output)
12+
for shade in range(10,1,-4):
13+
layer = Image.new('RGB', img.size, color=(255,0,255))
14+
output = Image.blend(img, layer, shade/30)
15+
images.append(output)
16+
for shade in range(10,1,-4):
17+
layer = Image.new('RGB', img.size, color=(255,255,0))
18+
output = Image.blend(img, layer, shade/30)
19+
images.append(output)
20+
21+
x=0
22+
y=0
23+
contact_sheet=PIL.Image.new(img.mode, (3*img.width,3*img.height))
24+
for insert in images:
25+
contact_sheet.paste(insert,(x,y))
26+
if x+img.width == contact_sheet.width:
27+
x=0
28+
y=y+img.height
29+
else:
30+
x=x+img.width
31+
32+
contact_sheet=contact_sheet.resize((1200,750))
33+
display(contact_sheet)
34+
35+
36+

0 commit comments

Comments
 (0)