Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python, the code shown doesnt work For your final image manipulation problem in this worksheet, write program that takes an image in any mode and

python, the code shown doesnt work image text in transcribed
image text in transcribed
image text in transcribed
For your final image manipulation problem in this worksheet, write program that takes an image in any mode and increases its size as described on the previous slide. The program should ask the user to enter a filename, an integer multiplier for the width and an integer multiplier for the height. It should open this file, perform the transformation and then save the larger version of the image to the file 'output.png'. Here is an example of the effect your program should produce: astronaut.png Enter a filename: astronaut.png Enter a width multiplier: 1 Enter a height multiplier: 2 nstructions Forum Tutoring Problem astronaut.png Enter a filename: astronaut.png Enter a width multiplier: 1 Enter a height multiplier: 2 Lotion 1 from PIL import Image 2 4 5 LON 3 def changeDimension(image_file,w,h): image = Image.open(image_file) #Opening image im_width, im_height = image.size #Storing actual size of image resize = image.resize((im_width*w, im_height*h)) #resizing image by mult resize.save("output.png'") #Saving the file resize.show() #Showing resized file 9 image.show() #Showing original file 10 file_name = input("Enter a filename: ") #Asking user for file name 11 width = int(input("Enter a width multiplier: ")) #Integer multiplier of wig 12 height = int(input("Enter a height multiplier: ")) #Integer multiplier of 13 changeDimension(file_name,width, height) #Calling changeDimension function 00 Submissions Output Autosaved a few seconds ago Load 11 minutes ago Load Paste snapshot saved 11 minutes ago Load Paste snapshot saved 14 minutes ago Load #1 Not yet! Failed a test

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

Step: 3

blur-text-image

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions