import{_ as a,a as t,b as r,ag as d}from"./chunks/framework.BcrMLAmg.js";const g=JSON.parse('{"title":"Image","description":"","frontmatter":{},"headers":[],"relativePath":"references/elements/Image.md","filePath":"references/elements/Image.md","lastUpdated":1757844696000}'),i={name:"references/elements/Image.md"};function o(h,e,l,n,s,c){return r(),t("div",null,e[0]||(e[0]=[d('
This is the Image element class which can be used to display bimg formatted images.Bimg is a universal ComputerCraft image format.See: https://github.com/SkyTheCodeMaster/bimg
Extends: VisualElement
| Property | Type | Default | Description |
|---|---|---|---|
| bimg | table | {} | The bimg image data |
| currentFrame | number | 1 | Current animation frame |
| autoResize | boolean | false | Whether to automatically resize the image when content exceeds bounds |
| offsetX | number | 0 | Horizontal offset for viewing larger images |
| offsetY | number | 0 | Vertical offset for viewing larger images |
| Method | Returns | Description |
|---|---|---|
| Image:resizeImage | Image | Resizes the image to the specified width and height |
| Image:getImageSize | number, number | Gets the size of the image |
| Image:getPixelData | fg, bg, char | Gets pixel information at position |
| Image:setText | Image | Sets the text at the specified position |
| Image:getText | string | Gets the text at the specified position |
| Image:setFg | Image | Sets the foreground color at the specified position |
| Image:getFg | string | Gets the foreground color at the specified position |
| Image:setBg | Image | Sets the background color at the specified position |
| Image:getBg | string | Gets the background color at the specified position |
| Image:setPixel | Image | Sets the pixel at the specified position |
| Image:nextFrame | Image | Advances to the next frame in the animation |
| Image:addFrame | Image | Adds a new frame to the image |
| Image:updateFrame | Image | Updates the specified frame with the provided data |
| Image:getFrame | table | Gets the specified frame |
| Image:getMetadata | table | Gets the metadata of the image |
| Image:setMetadata | Image | Sets the metadata of the image |
Resizes the image to the specified width and height
width number The new width of the imageheight number The new height of the imageImage self The Image instanceGets the size of the image
number width The width of the imagenumber height The height of the imageGets pixel information at position
x number X positiony number Y positionfg Foreground colorbg Background colorchar Character at positionSets the text at the specified position
x number The x positiony number The y positiontext string The text to setImage self The Image instanceGets the text at the specified position
x number The x positiony number The y positionlength number The length of the text to getstring text The text at the specified positionSets the foreground color at the specified position
x number The x positiony number The y positionpattern string The foreground color patternImage self The Image instanceGets the foreground color at the specified position
x number The x positiony number The y positionlength number The length of the foreground color pattern to getstring fg The foreground color patternSets the background color at the specified position
x number The x positiony number The y positionpattern string The background color patternImage self The Image instanceGets the background color at the specified position
x number The x positiony number The y positionlength number The length of the background color pattern to getstring bg The background color patternSets the pixel at the specified position
x number The x positiony number The y positionchar string The character to setfg string The foreground color patternbg string The background color patternImage self The Image instanceAdvances to the next frame in the animation
Image self The Image instanceAdds a new frame to the image
Image self The Image instanceUpdates the specified frame with the provided data
frameIndex number The index of the frame to updateframe table The new frame dataImage self The Image instanceGets the specified frame
frameIndex number The index of the frame to gettable frame The frame dataGets the metadata of the image
table metadata The metadata of the imageSets the metadata of the image
key string The key of the metadata to setvalue string The value of the metadata to setImage self The Image instance