Image¶
Bases: object
Image class represents an image with associated metadata.
This class encapsulates raw image data associated with metadata, providing methods to access pixel properties, dimensions, and metadata.
__init__(imageData, metadata)
¶
Constructor.
Initializes a new instance of the Image class with raw data and metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
imageData
|
list[int]
|
The raw bytes of the image |
required |
metadata
|
dict[string, Metadata]
|
A map pairing metadata keys with values |
required |
getPixelSize()
¶
Get the pixel size.
Retrieves the size of a single pixel in bytes.
Returns:
| Type | Description |
|---|---|
int
|
The pixel size in bytes |
getBitDepth()
¶
Get the image bit depth.
Retrieves the bit depth of the image (e.g., 8, 16 bits).
Returns:
| Type | Description |
|---|---|
int
|
The bit depth of the image |
getWidth()
¶
Get the image width.
Retrieves the width of the image in pixels.
Returns:
| Type | Description |
|---|---|
int
|
The width of the image in pixels |
getHeight()
¶
Get the image height.
Retrieves the height of the image in pixels.
Returns:
| Type | Description |
|---|---|
int
|
The height of the image in pixels |
getPixelType()
¶
Get the pixel type.
Retrieves the format of the pixels (bit depth and gray/rgb).
Returns:
| Type | Description |
|---|---|
int
|
The pixel type |
getImageData()
¶
Get the image data.
Retrieves the raw image data.
Returns:
| Type | Description |
|---|---|
None
|
The image data |
hasMetadata(name)
¶
Check if a metadata exists.
Determines if a specific metadata exists in the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
string
|
The name of the metadata to check |
required |
Returns:
| Type | Description |
|---|---|
boolean
|
True if the metadata exists, false otherwise |
addMetadata(name, value)
¶
Add or update a metadata.
Inserts a new metadata or updates an existing one.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
string
|
The name of the metadata |
required |
value
|
Metadata
|
The metadata value to store |
required |
removeMetadata(name)
¶
Remove a metadata.
Deletes a metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
string
|
The name of the metadata to remove |
required |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If an error occurs |
getMetadata(*args)
¶
Overload 1:
Get all metadata.
Retrieves all metadata associated with the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
string
|
The name of the metadata |
required |
Returns:
| Type | Description |
|---|---|
Metadata
|
The metadata value |
Raises:
| Type | Description |
|---|---|
InscoperException
|
If the key is not found or an error occurs |