# IMAGE

## Content

This function input an URL or a base64 string to show an image in cell.

## Syntax

`IMAGE(url, [mode, height, width, clipX, clipY, clipHeight, clipWidth, vAlign, hAlign])`

## Arguments

| Argument | Description |
| -------- | ----------- |
| *URL* | The location of the image on the web or base64 string. |
| *mode* | (Optional) Specifies how to size the image.<br>1 - Keep the aspect ratio to fit the cell.<br>2 - Stretch the image to cover the entire cell.<br>3 - Keep original size even if cropped.<br>4 - custom<br>The default value is 1. |
| *height* | (Optional) The height of image. The *mode* option must be 4. |
| *width* | (Optional) The width of image. The *mode* option must be 4. |
| *clipX* | (Optional) The x-axis coordinate of the top left corner of the source image sub-rectangle to draw into the destination context. The default value is 0. |
| *clipY* | (Optional) The y-axis coordinate of the top left corner of the source image sub-rectangle to draw into the destination context. The default value is 0. |
| *clipHeight* | (Optional) The height of the source image sub-rectangle to draw into the destination context. The default value is the height of image. |
| *clipWidth* | (Optional) The width of the source image sub-rectangle to draw into the destination context. The default value is the width of image. |
| *vAlign* | (Optional) Vertical alignment of the image.<br>0 - Top<br>1 - Center<br>2 - Bottom<br>The default value is 1 (center). |
| *hAlign* | (Optional) Horizontal alignment of the image.<br>0 - Left<br>1 - Center<br>2 - Right<br>The default value is 1 (center). |

## Data Types

Returns sparkline.

## Examples

```JavaScript
sheet1.setFormula(2, 0, '=IMAGE("https://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Flag_of_the_People%27s_Republic_of_China.svg/23px-Flag_of_the_People%27s_Republic_of_China.svg.png")');
sheet1.setFormula(3, 0, '= IMAGE("https://upload.wikimedia.org/wikipedia/en/4/41/Flag_of_India.svg")');
```