Locking Multiple Images to Backgrounds on Google Slides

Locking certain parts of a Google Slides assignment to the background of the slides can prevent unnecessary frustration for both you and your students. However, the standard process for setting a specific image to the background can be tedious, especially if the assignment contains more than a few slides. A Google Slides template using Google Apps Script provides a fast and easy solution and has saved me a countless number of hours and hundreds of clicks on trackpad.

Create a template to lock multiple images as backgrounds on Google slides on click.

  1. Open a new Google Slides presentation.
  2. Open the Script editor.
  3. Copy and paste the code into the Script editor.
  4. Save the script file
  5. Reload the Slides presentation
  6. Insert images onto the first slide.
  7. Run "Set as Backgrounds" from the "Images" menu. You will need to authorize the script the first time it has run.

/** 
 * @OnlyCurrentDoc
 */
 
function onOpen() {
  var ui = SlidesApp.getUi();
  ui.createMenu('Images')
  .addItem('Set as Backgrounds', 'setBackgrounds')
  .addToUi();
}

function setBackgrounds(){
  var slides = SlidesApp.getActivePresentation();
  var images = slides.getSlides()[0].getImages();
  if(images.length > 0){
  images.forEach(function addBG(picture){
    let slide = slides.appendSlide(SlidesApp.PredefinedLayout.BLANK);
    slide.getBackground().setPictureFill(picture);
  });
  } else {
    SlidesApp.getUi().alert("There are no images on this slide.");
  }
}
Copyright © 2022 WhatEverItSaysIsFine privacy policyterms & conditions