Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

fix image print docs (#2488)

Edgar Riba9cd42f2d98ae
diff --git a/kornia/image/image.py b/kornia/image/image.py
index f5893d6be..6f80d04b9 100644
--- a/kornia/image/image.py
+++ b/kornia/image/image.py
@@ -282,14 +282,14 @@ class Image:
def print(self, max_width: int = 256) -> None:
"""Print the image tensor to the console.
- .. image:: https://github.com/kornia/data/blob/a82d2bdc868f3774a1be91419a2870e54222389e/print_image.png
-
Args:
max_width: the maximum width of the image to print.
- Example:
- >>> data = np.ones((4, 5, 3), dtype=np.uint8) # HxWxC
- >>> img = Image.from_numpy(data)
- >>> img.print()
+ .. code-block:: python
+
+ img = Image.from_file("panda.png")
+ img.print()
+
+ .. image:: https://github.com/kornia/data/blob/main/print_image.png?raw=true
"""
print(image_to_string(self.data, max_width))
diff --git a/kornia/utils/image_print.py b/kornia/utils/image_print.py
index e8bbd6c0c..2c170942f 100644
--- a/kornia/utils/image_print.py
+++ b/kornia/utils/image_print.py
@@ -372,7 +372,7 @@ def image_to_string(image: Tensor, max_width: int = 256) -> str:
def print_image(image: Union[str, Tensor], max_width: int = 96) -> None:
"""Print an image to the terminal.
- .. image:: https://github.com/kornia/data/blob/a82d2bdc868f3774a1be91419a2870e54222389e/print_image.png
+ .. image:: https://github.com/kornia/data/blob/main/print_image.png?raw=true
Args:
image: path to a valid image file or a tensor.