Class Image


Deprecated. The UI service was deprecated on December 11, 2014. To create user interfaces, use the HTML service instead.

A widget that displays the image at a given URL.

The image can be in 'unclipped' mode (the default) or 'clipped' mode. In clipped mode, a viewport is overlaid on top of the image so that a subset of the image will be displayed. In unclipped mode, there is no viewport - the entire image will be visible. Whether an image is in clipped or unclipped mode depends on how the image is constructed, and how it is transformed after construction. Methods will operate differently depending on the mode that the image is in. These differences are detailed in the documentation for each method.

Here is an example of how to use this widget:

function doGet() {
  var app = UiApp.createApplication();
  // The very first Google Doodle!
  // Just the man in the middle
  app.add(app.createImage("", 118, 0, 50, 106));
  return app;

Due to browser-specific HTML constructions needed to achieve the clipping effect, certain CSS attributes, such as padding and background, may not work as expected when an image is in clipped mode. These limitations can usually be easily worked around by encapsulating the image in a container widget that can itself be styled.

Internally, UiApp widgets are built on top of the Google Web Toolkit, and it can sometimes be helpful to look at the GWT documentation directly. You can find the Image documentation here.

Deprecated methods

Send feedback about...

Apps Script
Apps Script
Need help? Visit our support page.