Chris Schneider

Code

Slides Fit / Fill Image

Animated GIF of Slides Fit/Fill Image Add-on in use

Click to view this project on GitHub.




Description: A Google Apps Script add-on for Slides that fits or fills a selected image to the maximum size on a slide. Note that "fitting" involves the longest side of an image matching that of its canvas, whereas "filling" here involves the image scaling to fit the canvas exactly. In this usage, aspect ratio is preserved for all cases.




Background: At my previous teaching job, I solely used Google Suite applications like Google Slides and Google Docs. A small yet exasperating inconvenience of mine was that in order to maximally resize a pasted image in Slides, you need to manually resize it past the edge of the slide, then tediously crop it, sometimes tweaking the size several times before arriving at a centered, full-slide sized image.




"There's got to be a better way!"




Features: I wrote this add-on to include a modal UI that shows a live preview of a selected image. Users can select quick options to resize an image to fit or fill the entire slide, half, or a quarter. A particular fraction (i.e. the left or right half of a portrait orientation) can be selected or all fractions can be generated at once. Images can be inserted to the current slide or to a new slide with a toggle option.




Conclusion: I learned a lot during this quick project, particularly about the Google Slides service, image blobs, and passing data and function calls between client and server side code. I have quite a few ideas for similar "teacher tool" add-ons for Google Slides and I'd like to eventually bundle several together and publish them on the Google Marketplace.




^

© 2022, Chris Schneider. All Rights Reserved.