Image
Image manipulation and creation
Image provides methods to load and work with images from files or data.
Use Image to:
Note
Images are represented as objects with base64, width, and height properties
Examples
javascript
let fm = FileManager.local();
let image = fm.readImage("path/to/image.png");
console.log(image.size); // { width: 100, height: 100 }javascript
let data = Data.fromBase64(base64String);
let image = Image.fromData(data);Properties
size
- Type:
[String: CGFloat]
Image size
Returns the dimensions of the image as a dictionary with width and height.
javascript
image.size.width, image.size.heightMethods
fromFile
Create image from file path
Loads an image from the specified file path.
typescript
static fromFile(filePath): object | nullfilePath- The absolute path to the image file
Returns: Image object or null if file doesn't exist or is not a valid image
Example:
javascript
Image.fromFile("/path/to/image.png")fromData
Create image from Data
Creates an image from a Data object containing image data.
typescript
static fromData(dataBridge): object | nulldataBridge- Data object containing image bytes
Returns: Image object or null if data is not a valid image
Example:
javascript
Image.fromData(data)