Question
Need help to resize your images so that they all take up less than 50 K of disc space. To resize an image using MS
Need help to resize your images so that they all take up less than 50 K of disc space.
To resize an image using MS Notepad:
- Right click on the image in the Windows Explorer and open it with Notepad.
Select Main Menu Resize >> In the Resize box
Leave Percentage radio button selected >>
Enter 50 and 50 in the Horizontal and Vertical text boxes
to reduce the width and height of the image by 50%.
Click OK.
Right click on the image and select Properties to see the new image size. Continue to reduce the image disc size until it is less than 50 K.
To resize an image on a Mac: Right-click (or Ctrl-click) on the file in Finder and select Services >> Resize Image from the contextual dropdown menu. You can also drag a selection box over several images and resize them all at once using the service.
- Your script should read an index file, create a new folder for each album, then rename and copy the image files into the album folders. See the pseudocode below. Add print statements in your script to tell the tell the user what your script is doing.
Here is pseudocode that you can use:
Import os and shutil modules. Assign previous_album to the empty string (""). Open index file, call the file object fin. Read first line of input file. While input file not empty, Use split to obtain fields. Assign zeroth field to folder_name. Assign first field to original_photo_name If previous_album != folder_name Use os.mkdir to create new folder named folder_name. Initialize counter to 1. Assign folder_name to previous_album End. # Next two lines are literal Python statements. new_photo_name = "{:s}/{:03d}-{:s}". \ format(folder_name, counter, original_photo_name) Use shutil.copy method to copy "originals/" + original_photo_name to new_photo_name. Add one to counter. Read next line of input file. End.
In python language
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started