← All ivy-nodes
IVYXSTUDIO · IVY NODE
I
Image Show
ivy.node.image-show · v0.1.0
ivyx✓
Shows a loaded image in the cell's output and returns its width and height. Takes the image_processor handle that image-processor returns.
#Image Display#Pillow#PIL#Image Viewer#Image Loading#Image Handling
Inputs
| Field | Type | Description |
|---|---|---|
| image_processorrequired | Not declared | A loaded image from image-processor. |
Outputs
| Field | Type | Description |
|---|---|---|
| widthrequired | integer | Width of the image shown. |
| heightrequired | integer | Height of the image shown. |
Source
python
inp = __ivy_ctx__["nodes"][__ivy_node_id__]["input"]
image_processor = inp["image_processor"]
# Show the image in the cell's output, where a notebook or a run log can see
# it. (The inherited cell called Pillow's `show()`, which asks the operating
# system to open a viewer from inside a kernel, and annotated its parameter
# with a class defined in another node's cell, so it raised NameError alone.)
image = getattr(image_processor, "image", None)
if image is None:
raise AttributeError("No image loaded; pass the image_processor output of image-processor.")
try:
from IPython.display import display
display(image)
except ImportError:
pass
out = __ivy_ctx__["nodes"][__ivy_node_id__]["output"]
out["width"], out["height"] = image.sizeTests
Requires: python:3.9, pillow
- shows-2x3
A loaded 2x3 image is shown and its size returned.
- nothing-loaded
An object with no loaded image is refused.