How to Make all Shapes the Same Size in Google Slides

Hey, friends today I will teach you How to Make all Shapes the Same Size in Google Slides. so let get started with today Code snippets. Getting different problems is altogether gives a very different experience. today the Code snippets I am going to share with you is How to Make all Shapes the Same Size in Google Slides.

How to Make all Shapes the Same Size in Google Slides

Microsoft PowerPoint has this truly valuable element that lets you handily resize different shapes in a slide to a similar size. You can choose the shapes you need to resize and afterwards click on the Format Pane button. Here, under the Size and Position tab, you can resize the shapes to the necessary size.

Also Read: न्यूनतम बंडल आकार के लिए अपने जावास्क्रिप्ट प्रोजेक्ट्स में लोडाश आयात करने का सबसे अच्छा तरीका

Google Slides doesn’t permit you to resize various shapes in a slide however you can utilize Google Apps Script to do exactly the same thing. Go to the Tools menu and select Script Editor. Here duplicate glue the code underneath and click on the Run button.

It will match the tallness and width of the principal shape in the slide and resize every one of the shapes in the slide to a similar stature and width. The shapes are additionally repositioned with the end goal that there’s the equivalent distance between the shapes and the top edge of the shapes are in arrangement.

const resizeSlideShapes = () => {
  const SPACING = 20;
  const [slide] = SlidesApp.getActivePresentation().getSlides();
  const [baseShape, ...targetShapes] = slide.getShapes();

  // Is the shape rectangular or triangular
  const shapeType = baseShape.getShapeType();

  // Get the shape height and width
  const height = baseShape.getHeight();
  const width = baseShape.getWidth();

  // Get the co-ordinates of the base shape
  const topPosition = baseShape.getTop();
  const leftPosition = baseShape.getLeft();

  targetShapes
    .filter((shape) => shape.getShapeType() === shapeType)
    .forEach((shape, index) => {
      shape.setHeight(height);
      shape.setWidth(width);
      shape.setTop(topPosition);
      shape.setLeft(leftPosition + (width + SPACING) * (index + 1));
    });
};

The Google Script can deal with both Rectangle and Triangle shapes. If it’s not too much trouble, note that the principal shape in the slide is the base shape and will decide the tallness and width of different shapes in a similar slide.

Match Rectangle Shapes

Match Shape Sizes

Match Triangle Shapes

Resize and Align Shapes

You can use the same technique to recolor shapes and make all shapes the same color. You can play around with the shapes template here.

Leave a Comment