logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Bhargav AppasaniEngineering
(/5)

784 Answers

Hire Me
expert
Mason RamirezzTechnical writing
(4/5)

545 Answers

Hire Me
expert
Les BarkerLaw
(5/5)

864 Answers

Hire Me
expert
StatAnalytica ExpertSociology
(5/5)

942 Answers

Hire Me
Python Programming
(5/5)

compose a function called scale(image, scale_factor) based on the code given, that rescales due to a scale factor.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

import sys

import stddraw

from picture import Picture

fil = sys.argv[1]

wT = int(sys.argv[21)

hT = int(sys.argv[3])

source Picture (f il)

target = Picture(wT, hT)

for colT in range(wT):

for rowT in range(hT):

colS colT * source.width() ¡I wT

rowS = rowT * source.height() II hT

target.set(colT, rowT, source .get(colS, rowS))

stddraw. setCanvasSize(wT, hT)

stddraw . picture (target)

stddraw. show ()

Based on this code, compose a function with the following definition:

def scale(image, scale_f actor): that accepts a Picture object (not a string, pass the actual Picture object) and a floating-point scale factor, and returns a new Picture object that contains the image contained in the argument, but with its dimensions scaled by the specified factor. For example, if a 500-by-5(X) pixel image is used as input, and a scale factor of 2.0 is specified, the returned Picture object should be 1000-by- 1000 pixels in size.

Once this function has been defined, write the main function that takes a filename and a scale factor as command-line arguments, and then calls the scale function using those inputs, and then displays the resulting scaled image. Call this file scale_test. py.

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme