Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Answer should be give in Python Idle 3.9.1 import matplotlib.pyplot as plt import numpy as np size = int(input(Enter the size: )) fname = str(input(Enter

Answer should be give in Python Idle 3.9.1

import matplotlib.pyplot as plt

import numpy as np

size = int(input("Enter the size: "))

fname = str(input("Enter output file: "))

#Initialize Image as white color with value 1 in all the pixel

img = np.ones( (size,size,3) )

for i in range(1,size,2):

for j in range(size):

img[i][j][1] = 1

img[i][j][0] = 0

img[i][j][2] = 0

plt.imsave(fname, img) Tried this ..it didn't work, because need the colors in "Purple" and "Cyan" , but the answer should be in SAME Format. there are other answer available for this same question, but that format answer doesn't work. image text in transcribed

Write a program that creates an image of purple and cyan horizontal stripes. Think color not shade: Purple = red and blue only, no green. Cyan = green and blue only, no red. Your program should ask the user for the size of your image, the name of the output file, and create a .png file of stripes. For example, if the user enters 10, your program should create a 10x10 image, alternating between purple and cyan stripes. A sample run of the program: Enter the size: 10 Enter output file: 10 stripes.png Another sample run of the program: Enter the size: 50 Enter output file: 50stripes.png

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

In what context did the study and teaching of communication begin?

Answered: 1 week ago