# IMAGE

## Content

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

## Syntax

`=IMAGE(source, [alt_text], [sizing], [height], [width], [clipX], [clipY], [clipHeight], [clipWidth], [vAlign], [hAlign])`

## Arguments

| Argument | Description |
| -------- | ----------- |
| *source* | (Required) The URL path, using an "https" protocol, of the image file. |
| *alt\_text* | (Optional) Alternative text that describes the image for accessibility. |
| *sizing* | (Optional) Specifies the image dimensions.<br>There are several possible values:<br>0 - Fit the image in the cell and maintain its aspect ratio.<br>1 - Fill the cell with the image and ignore its aspect ratio.<br>2 - Maintain the original image size, which may exceed the cell boundary.<br>3 - Customize the image size by using the height and width arguments.<br> <br>The default value is 0. |
| *height* | (Optional) The height of the image in pixels. |
| *width* | (Optional) The width of the image in pixels. |
| *clipX* | (Optional) The x-axis coordinate of the top left corner of the source image sub-rectangle to draw into the destination context. <br>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. <br>The default value is 0. |
| *clipHeight* | (Optional) The height of the source image sub-rectangle to draw into the destination context. <br>The default value is the height of image. |
| *clipWidth* | (Optional) The width of the source image sub-rectangle to draw into the destination context. <br>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 2 (bottom). |
| *hAlign* | (Optional) Horizontal alignment of the image.<br>0 - Left<br>1 - Center<br>2 - Right<br>The default value is 0 (left). |

> **Note**: SJS does not support import and export when the source is base64.

### Limitation

A cross-domain URL prevents SpreadJS from getting image information and prevents images from being displayed when exported to Excel. However, the user can edit the cell to request image information.

## 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")');
```