I want to scale up a part of a picture, in this example, a nose.
I have a function to select the part of the picture I want to enlarge.
def copyAndPaste(picture):
height = getHeight(picture)
width = getWidth(picture)
newPicture = makeEmptyPicture(width, height)
for x in range(width):
for y in range(height):
pxl = getPixel(picture,x,y)
if (x>48 and x<59) and (y>58 and y<71):
newPxl =getPixel(newPicture, #?,#?)
else:
newPxl = getPixel(newPicture, x,y)
color = getColor(pxl)
setColor(newPxl,color)
return newPicture
def d():
f=pickAFile()
picture=makePicture(f)
newPicture = copyAndPaste(picture)
writePictureTo(newPicture, r"D:\FOLDER\0Pic4.jpg")
explore (newPicture)
I also have a function to enlarge a picture:
def Enlarge(picture):
height = getHeight(picture)
width = getWidth(picture)
newPicture = makeEmptyPicture(width*2, height*2)
x1=0
for x in range(0,width):
y1=0
for y in range(0,height):
pxl = getPixel(picture,x,y)
newPxl = getPixel(newPicture, x1,y1)
color = getColor(pxl)
setColor(newPxl,color)
y1=y1+2
x1=x1+2
return newPicture
eg.
From:
To:
I have tried many things, but cannot work out how to combine the two to enlarge part of a picture, leaving the rest of the picture in tact.
This is what the resulting picture should look like (as ridiculous as it is),
I have been practicing on small images, as the program can take so long to execute, it is not viable to work with larger images, at this stage, meaning the results are sketchy, but will at least show if it works.