-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopyPicBad.py
69 lines (62 loc) · 2.27 KB
/
copyPicBad.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
def copyPicBad():
sourcePic = makePicture(getMediaPath('barbara.jpg'))
targetPic = makePicture(getMediaPath('7inx95in.jpg'))
show(sourcePic)
show(targetPic)
for x in range(getWidth(sourcePic)):
for y in range(getHeight(sourcePic)):
sourcePix = getPixel(sourcePic, x, y)
sourceColor = getColor(sourcePix)
targetPix = getPixel(targetPic, x, y)
setColor(targetPix, sourceColor)
repaint(targetPic)
def copyBadTwo():
sourcePic = makePicture(getMediaPath('barbara.jpg'))
targetPic = makePicture(getMediaPath('7inx95in.jpg'))
show(sourcePic)
show(targetPic)
targetX = 200
for x in range(getWidth(sourcePic)):
targetY = 100
for y in range(getHeight(sourcePic)):
sourcePix = getPixel(sourcePic, x, y)
sourceColor = getColor(sourcePix)
targetPix = getPixel(targetPic, targetX, targetY)
setColor(targetPix, sourceColor)
targetY = targetY + 1
targetX = targetX + 1
repaint(targetPic)
def copyBadCrop():
sourcePic = makePicture(getMediaPath('barbara.jpg'))
targetPic = makePicture(getMediaPath('7inx95in.jpg'))
show(sourcePic)
show(targetPic)
targetX = 200
for x in range(70,174):
targetY = 100
for y in range(90,192):
sourcePix = getPixel(sourcePic, x, y)
sourceColor = getColor(sourcePix)
targetPix = getPixel(targetPic, targetX, targetY)
setColor(targetPix, sourceColor)
targetY = targetY + 1
targetX = targetX + 1
repaint(targetPic)
def copySmaller():
sourcePic = makePicture(getMediaPath('barbara.jpg'))
targetPic = makePicture(getMediaPath('7inx95in.jpg'))
show(sourcePic)
show(targetPic)
width = getWidth(sourcePic)
height = getHeight(sourcePic)
sourceX = 0
for targetX in range(width/2):
sourceY = 0
for targetY in range(0,height/2):
sourcePix = getPixel(sourcePic, sourceX, sourceY)
sourceColor = getColor(sourcePix)
targetPix = getPixel(targetPic, targetX, targetY)
setColor(targetPix, sourceColor)
sourceY = sourceY + 2
sourceX = sourceX + 2
repaint(targetPic)