> For the complete documentation index, see [llms.txt](https://osl.mistium.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://osl.mistium.com/graphics-osl-window/rendering/elements/image.md).

# Image

The `image` command renders an image from a raw URL with optional width and height specifications.

### Syntax:

```javascript
image "url" width_in_pixels height_in_pixels
```

### Parameters:

* `"url"`: The raw URL of the image to be rendered.
* `width_in_pixels` (optional): The width of the rendered image in pixels. If null, the image will resize to fit its width correctly, and its height will adjust accordingly to maintain the original aspect ratio.
* `height_in_pixels` (optional): The height of the rendered image in pixels. If null, the image will stretch or shrink to match the specified width, preserving its aspect ratio.

### Example:

```javascript
image "https://example.com/image.jpg" 120 80
```

In this example, an image from the specified URL is rendered with a width of 120 pixels and a height of 80 pixels.

### Additional Notes:

* The image command supports raw image URLs and can render images from web sources.
* There is no maximum limit on the size of the image that can be rendered.
* If the image fails to load or if the URL is inaccessible, a "not loaded" placeholder image will be displayed.
* Images can be positioned on the screen using the draw cursor and rotated using direction commands.
* While data URLs can be used with the `image` command, it's not recommended due to potentially large file sizes.
* Images with alpha channels (transparency) are supported and rendered appropriately.
* The old `image "load" "data" "name"` cache mode is legacy originOS syntax and is not supported by the current compiler.
