February 2018
Beginner to intermediate
364 pages
10h 32m
English
Here is how proceed with the recipe:
Run the script for the recipe. It will execute the following code:
from os.path import expanduserimport constfrom core.file_blob_writer import FileBlobWriterfrom core.image_thumbnail_generator import ImageThumbnailGeneratorfrom util.urls import URLUtility# download the image and get the bytesimg_data = URLUtility(const.ApodEclipseImage()).data# we will store this in our home folderfw = FileBlobWriter(expanduser("~"))# Create a thumbnail generator and scale the imagetg = ImageThumbnailGenerator(img_data).scale(200, 200)# write the image to a filefw.write("eclipse_thumbnail.png", tg.bytes)
The result from this will be a file named eclipse_thumbnail.png written into your home directory.
Read now
Unlock full access