Answer to Question #335789 in Python for xxx

Question #335789

1. Create a reflection of the given image.

2. Submit the code


images name(mt-rainier.jpg)


1
Expert's answer
2022-04-30T08:16:18-0400
from PIL import Image
from numpy import asarray


def reverse_img(filename, reversed_filename):
	image = Image.open(image_name)
	data = asarray(image)
	for i in range(len(data)):
		data[i] = data[i][::-1]
	image2 = Image.fromarray(data)
	image2.save(reversed_filename)

image_name = 'mt-rainier.jpg'
reflected_name = 'mt-rainier_ref.jpg'
reverse_img(image_name, reflected_name)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS