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

............................. I wanna this assignment work in python Write a fun

ID: 655808 • Letter: #

Question

............................. I wanna this assignment work in python
Write a function interleave two pictures take the first 20 pixels from the first picture and then 20 pixels from the second picture and then the next 20 pixels from the first picture and then the next 20 pixels from the second picture and so on till all the pixels have been uses.

HINT: the total width of the two pictures should be less than the width of your target.

Be sure to include the comments at the beginning of the program as stated in previous assigments.

Explanation / Answer

In this python program all pictures pixels are same as 20 pixle.

1.   import Image
2.   images = ['image.jpg','image.jpg','image.jpg','image.jpg']
3.     
4.   hsize = min(20,len(images))
5.   vsize = (len(images)/20) + 1
6.     
7.   print hsize,vsize
8.     
9.   vspace = 20
10.   hspace = 20
11.     
12.   (h,w) = Image.open(images[0]).size
13.     
14.   im = Image.new('RGB',((hsize*(h+hspace)),(vsize*(w+vspace)) ))
15.     
16.   for i,filename in enumerate(images):
17.   imin = Image.open(filename).convert('RGB')
18.   xpos = i % hsize
19.   ypos = i / hsize
20.   print xpos,ypos
21.   im.paste(imin,(xpos*(h+hspace),ypos*(w+vspace)))
22.   im.save('output.jpg')
23.