Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Jython program that uses two identical-height images and creates an acc

ID: 670826 • Letter: C

Question

Create a Jython program that uses two identical-height images and creates an accordion collage of the two such that it can be folded to see just one picture. Your completed solution should do the following: Accept one input parameter that will control into how many pieces the photos will be sliced to make the collage. Accept as input two images that are the same height. The widths can vary. The program should prompt for the image files. Get the dimensions of the image from the image itself, so your program will work with any size image. One hundred slices would look like this: Display the resulting collage on screen.

Explanation / Answer

def slices(n):

print(n)

img1=pickafile()

first_pic = makePicture(img1)

show(first_pic)

img2=pickafile()

second_pic = makePicture(img2)

show(second_pic)

first_pic_width = getWidth (first_pic)
first_pic_height = getHeight (first_pic)
second_pic_width = getWidth (second_pic)
second_pic_height = getHeight (second_pic)

new_width=first_pic_width/n

new_height=first_pic_height/n

collage= makeEmptyPicture(new_height, new_width)

    for newx in range(1,new_width+1):
     for newy in range(1,new_height+1):
       
       oldx = newx + 200
       oldy = newy + 10

    op1 = getPixel (opict, oldx, oldy)
    np1= getPixel (npict, nx, ny)

      
       c = getColor (op1)
       setColor (np1, c)


show (np1)