i have a given picture and have to create a picture that is twice as wide as the given picture. For each pixel (x, y) in the original picture, the pixels (2 * x, y) and (2 * x + 1, y) in the new picture should be set to the same color as it.
i am not allowed to use any other module( like PIL)
so i have to create a picture that is twice width
plz help me out here
here is what i have so far
import media
def widen(new_pic):
height = media.get_height(pic)
width = media.get_width(pic)
new_pic = media.create_picture( width * 2, height)
new_height = media.get_height(new_pic)
new_width = media.get_width(new_pic)
for y in range(0, new_height):
for x in range(0, new_width):
from_p = media.get_pixels(pic)
to_p = media.get_pixels(new_pic, 2 * x + 1, y)
media.set_color(to_p, media.get_color(from_p))
return new_pic
im not sure that i have used range function right but i dont really know how to use pixel pix to make same color