Images
Images are processed internally using the Pillow library. By obtaining a Python imaging library (PIL) image object, you can process images through the PIL library. Supported image formats include JPEG, PNG, and BMP.
|
Property |
Type |
Description |
|---|---|---|
|
filename |
str |
File name or path of the image (if loaded from a file). |
|
format |
str |
Image format (e.g. PNG, JPEG). |
|
height |
int |
Image height in pixels. |
|
width |
int |
Image width in pixels. |
|
data |
bytes |
Image data. |
|
pil_image |
PIL_Image.Image |
Dynamic property: Returns the Pillow image object (auto-decoded from data). |
|
Method |
Parameter |
Return Value |
Description |
|---|---|---|---|
|
__init__ |
filename: Union[str, os.PathLike] = None data: Union[str, PIL.Image] = None format: Optional[str] = None |
None |
Constructor: Loads an image from a file (filename) or data (data), supporting bytes or Pillow objects. |
|
to_numpy |
— |
np.ndarray |
Converts the image to a NumPy array (float32). |
|
resize |
new_shape: tuple[int, int] |
Image |
Returns a new resized image based on the specified dimensions. |
|
show |
— |
None |
Displays the image using Pillow's default viewer. |
|
to_thumbnail |
size: tuple[int, int] = (100, 100) |
Image |
Generates a thumbnail with the specified size. |
|
from_struct (class method) |
obj: dict (must include the fields filename, data, and format) |
Image |
Creates an Image object from a structured dictionary. |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot