Details about the methods and properties provided by ImageRot
Contains details about the common methods shared between Node and the browser environment
A method that prepares the image data from a provided File
, URL, path, IRotItem
or IRotData
.
- Type:
Promise<IRotItem>
- Resolves with an
IRotItem
object containing the prepared image data.
Name | Type |
---|---|
data | { data?: File | Buffer | IRotItem | IRotData, url?: string, file?: string } |
A method that applies one or more effects to the image data.
- Type:
Promise<IRotItem>
- Resolves with an
IRotItem
object containing the transformed image data.
Name | Type | Description |
---|---|---|
data | IRotItem |
The image data to transform. |
effect | string | string[] |
The effect or effects to apply. |
options | TEffectOptions |
The options for the applied effect(s). |
A method that applies one or more modes to the image data.
- Type:
Promise<IRotItem>
- Resolves with an
IRotItem
object containing the transformed image data.
Name | Type | Description |
---|---|---|
data | IRotItem |
The image data to transform. |
mode | string | string[] |
The mode or modes to apply. |
A method that fetches an image from a URL and converts it into a buffer.
- Type:
Promise<IRotData>
- Resolves with a buffer representing the image data and its dimensions.
Name | Type | Description |
---|---|---|
url | string |
The URL of the image to convert. |
A utility method that converts HSV (Hue, Saturation, Value) values to RGB (Red, Green, Blue) values.
- Type:
Tuple<[number, number, number]>
- A tuple representing the RGB values as an array of three numbers:
[red, green, blue]
.
Name | Type | Description |
---|---|---|
h | number |
The hue value (ranging from 0 to 1) to convert to RGB. |
s | number |
The saturation value (ranging from 0 to 1) to convert to RGB. |
v | number |
The value/brightness value (ranging from 0 to 1) to convert to RGB. |
This utility method takes the HSV values and calculates the corresponding RGB values using the provided formulas. The resulting RGB values are returned as a tuple [red, green, blue].
A utility method that converts RGB (Red, Green, Blue) values to HSV (Hue, Saturation, Value) values.
- Type:
Tuple<[number, number, number]>
- A tuple representing the HSV values as an array of three numbers:
[hue, saturation, value]
.
Name | Type | Description |
---|---|---|
r | number |
The red value (ranging from 0 to 255) to convert to HSV. |
g | number |
The green value (ranging from 0 to 255) to convert to HSV. |
b | number |
The blue value (ranging from 0 to 255) to convert to HSV. |
Returns a list of the exported modes
Returns a list of the exported effects
Contains details about the methods exclusively exposed to the Node environment
A method that creates an image file from a provided image data
- Type:
Promise<void>
- Resolves when the image has been successfully written to the provided path.
Name | Type | Description |
---|---|---|
data | IRotItem |
An object containing the image data, width, and height. |
path | string |
The path where the image should be saved. |
config? | object |
An optional configuration object for image creation. |
The optional config
parameter should be an object with the following properties:
Name | Type | Description |
---|---|---|
mime | string |
The MIME type of the image (default: 'image/png' ). |
A method that fetches an image from a URL and returns its data as a Uint8Array
along with its width and height.
- Type:
Promise<IRotData>
- Resolves with a
IRotData
object containing the image data, width and height.
Name | Type | Description |
---|---|---|
url | string |
The URL of the image to fetch. |
A utility method that converts a file buffer into a Uint8Array
.
- Type:
Promise<Uint8Array>
- Resolves with a
Uint8Array
containing the image data.
Name | Type | Description |
---|---|---|
buffer | Buffer |
A buffer containing the file data. |
Contains details about the methods exclusively exposed to the browser environment
A method that converts image buffer data into a Blob URL.
- Type:
Promise<string>
- Resolves with a Blob URL representing the image.
Name | Type | Description |
---|---|---|
data | IRotItem |
An object containing the image data, width, and height. |
Converts a buffer into an ImageBitmap object.
- Type:
Promise<ImageBitmap>
- A Promise that resolves with an ImageBitmap object that represents the input image data.
Name | Type | Description |
---|---|---|
data | IRotItem |
An object containing the image data, width, and height. |
A method that converts a File object into an image buffer.
- Type:
Promise<IRotData>
- Resolves with an object containing the image data buffer and the width and height of the image.
Name | Type | Description |
---|---|---|
file | File |
The file to convert to a buffer. |
Contains details about the different types that are used in this documentation
An interface representing image data for processing.
The interface has the following properties:
Property | Type | Description |
---|---|---|
data | Uint8Array |
The raw image data. |
width | number |
The width of the image. |
height | number |
The height of the image. |
An immutable tuple representing image data for processing.
- Type:
Tuple<Uint8Array | null, number, number>
The tuple has the following elements:
Index | Type | Description |
---|---|---|
0 | Uint8Array | null |
The raw image data in a typed array, or null . |
1 | number |
The width of the image. |
2 | number |
The height of the image. |