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. Supported image formats include JPEG and PNG.
| 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. |
| Method | Parameter | Return Value | Description |
|---|---|---|---|
| __init__ |
| 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. |
| crop | box: tuple[float, float, float, float] | Image | Crops a specified area in an image and returns a new image. |
| getbands | - | tuple: [str, ...] | Calls Pillow's getbands(). |
| getmode | - | str | Returns the image mode. |
| to_struct | - | dict | Returns the structured image data. |
What is your overall rating for this page?
Thank 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