← All ivy-nodes
IVYXSTUDIO · IVY NODE
I
Image Show
ivy.node.image-show · v0.0.0
ivyx✓
Displays images using the system's default image viewer. This node takes an image_processor instance from image-processor and displays the loaded image. Useful for debugging, visualization, or user interaction workflows. The image is shown in the operating system's default image viewer application. Requires image-processor node output.
#Image Display#Pillow#PIL#Image Viewer#Image Loading#Image Handling
Inputs
| Field | Type | Description |
|---|---|---|
| image_processorrequired | object | An instance of the PillowImageProcessor class that handles loading and processing of the image. (Node reference) |
| features | object | Features |
| labels | object | Labels |
Outputs
| Field | Type | Description |
|---|---|---|
| features | object | Features |
| labels | object | Labels |
Source
python
# Input preparation
inp = __ivy_ctx__["nodes"][__ivy_node_id__]["input"]
image_processor = inp["image_processor"]
# Compute
class PillowImageShow:
"""
A class to display images using the Pillow library.
"""
def __init__(self, processor: PillowImageProcessor):
"""
Initialize the PillowImageShow with an instance of PillowImageProcessor.
:param processor: An instance of the PillowImageProcessor class
that handles loading and processing of the image.
"""
self.processor = processor
def show(self):
"""
Display the loaded image using Pillow's `show` method.
This method uses the image loaded by the `PillowImageProcessor` instance
and displays it in the default image viewer of the operating system.
:raises AttributeError: If the `processor` has not loaded an image.
"""
if self.processor.image is None:
raise AttributeError("No image loaded in the PillowImageProcessor. Call `load_image()` first.")
self.processor.get_image().show()
pillow_image_show = PillowImageShow(processor=image_processor)
pillow_image_show.show()
# Output collection (runner reads __ivy_ctx__)
out = __ivy_ctx__["nodes"][__ivy_node_id__]["output"]Tests
Requires: python:3.11
- basic-image-display
Display image with valid processor (should succeed).
imagedisplaybasic