imshow


Nameimshow JSON
Version 0.2.3.post0 PyPI version JSON
download
home_page
SummaryFlexible and Customizable Image Display
upload_time2024-01-19 12:21:55
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
keywords image visualization
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <img src="https://github.com/wkentaro/imshow/raw/main/.readme/icon.png" width="200", height="200">
  <h1>Imshow</h1>
  <p>
    <b>Flexible and Customizable Image Display</b>
  </p>
  <br>
  <br>
  <br>
</div>

*Imshow* is a Python app to display images.

*Imshow* gives you:

- **Flexiblity** - CLI & Python interface;
- **Customizability** - visualize any data via the plugin system;
- **Fast & clean** image display.

## Installation

<a href="https://pypi.org/project/imshow"><img src="https://img.shields.io/pypi/pyversions/imshow.svg"></a>
<a href="https://pypi.python.org/pypi/imshow"><img src="https://img.shields.io/pypi/v/imshow.svg"></a>

```bash
python3 -m pip install imshow
```

## Usage

**Command-Line**

```bash
imshow examples/*.jpg
imshow examples --recursive  # --recursive (-r)
imshow examples -r --plugin tile --col 3  # --plugin (-p)
```

**Python**

```python
import glob

import imgviz
import imshow

images = (imgviz.io.imread(filepath) for filepath in glob.glob("examples/*.jpg"))
imshow.imshow(images)
```

## Builtin plugins

### `-p base` (**default**)

```
imshow examples/*.jpg
imshow examples --recursive  # auto-search image files
```

### `-p tile`

```
imshow examples/*.jpg -p tile --col 3 --row 3
imshow examples/*.jpg -p tile --col 3
```

<img src="https://github.com/wkentaro/imshow/raw/main/.readme/tile_0.png" height="200"> <img src="https://github.com/wkentaro/imshow/raw/main/.readme/tile_1.png" height="150">

### `-p mark`

```
imshow examples/*[0-9].jpg -p mark --mark-file examples/mark.txt
```

<img src="https://github.com/wkentaro/imshow/raw/main/.readme/mark_0.png" height="150"> <img src="https://github.com/wkentaro/imshow/raw/main/.readme/mark_1.png" height="150"> <img src="https://github.com/wkentaro/imshow/raw/main/.readme/mark_2.png" height="150"> 

## How to create custom plugin

You can pass a Python file that contains `class Plugin(base.Plugin)` to `--plugin, -p` to customize the behaviour of Imshow. Below example shows a countdown from 10 to 0 displayed as images.

<img src="https://github.com/wkentaro/imshow/raw/main/.readme/countdown_0.png" height=150> <img src="https://github.com/wkentaro/imshow/raw/main/.readme/countdown_1.png" height=150> <img src="https://github.com/wkentaro/imshow/raw/main/.readme/countdown_2.png" height=150>

See [`plugins/base.py`](https://github.com/wkentaro/imshow/blob/main/imshow/plugins/base.py) for the most basic example of scanning image files and displaying them.
For more examples, check [`plugins` folder](https://github.com/wkentaro/imshow/blob/main/imshow/plugins).

```bash
imshow examples/*.jpg --plugin examples/countdown_plugin.py --number 10
```

```python
import numpy as np
import imgviz
from imshow.plugins import base


class Plugin(base.Plugin):
    @staticmethod
    def add_arguments(parser):
        # define additional command line options
        parser.add_argument(
            "--number", type=int, default=10, help="number to count down from"
        )

    number: int

    def __init__(self, args):
        self.number = args.number

    def get_items(self):
        # convert command line options into items to visualize.
        # each item represent the chunk that is visualized on a single window.
        yield from range(self.number, -1, -1)

    def get_image(self, item):
        # convert item into numpy array
        image = np.full((240, 320, 3), 220, dtype=np.uint8)

        font_size = image.shape[0] // 2
        height, width = imgviz.draw.text_size(text=f"{item}", size=font_size)
        image = imgviz.draw.text(
            src=image,
            text=f"{item}",
            yx=(image.shape[0] // 2 - height // 2, image.shape[1] // 2 - width // 2),
            color=(0, 0, 0),
            size=font_size,
        )
        return image
```

## License

MIT

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "imshow",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "image,visualization",
    "author": "",
    "author_email": "Kentaro Wada <www.kentaro.wada@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/11/dd/c5e79491c8de739d533248dc334d2e454de6e36ab73d45d2713984dc69c0/imshow-0.2.3.post0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <img src=\"https://github.com/wkentaro/imshow/raw/main/.readme/icon.png\" width=\"200\", height=\"200\">\n  <h1>Imshow</h1>\n  <p>\n    <b>Flexible and Customizable Image Display</b>\n  </p>\n  <br>\n  <br>\n  <br>\n</div>\n\n*Imshow* is a Python app to display images.\n\n*Imshow* gives you:\n\n- **Flexiblity** - CLI & Python interface;\n- **Customizability** - visualize any data via the plugin system;\n- **Fast & clean** image display.\n\n## Installation\n\n<a href=\"https://pypi.org/project/imshow\"><img src=\"https://img.shields.io/pypi/pyversions/imshow.svg\"></a>\n<a href=\"https://pypi.python.org/pypi/imshow\"><img src=\"https://img.shields.io/pypi/v/imshow.svg\"></a>\n\n```bash\npython3 -m pip install imshow\n```\n\n## Usage\n\n**Command-Line**\n\n```bash\nimshow examples/*.jpg\nimshow examples --recursive  # --recursive (-r)\nimshow examples -r --plugin tile --col 3  # --plugin (-p)\n```\n\n**Python**\n\n```python\nimport glob\n\nimport imgviz\nimport imshow\n\nimages = (imgviz.io.imread(filepath) for filepath in glob.glob(\"examples/*.jpg\"))\nimshow.imshow(images)\n```\n\n## Builtin plugins\n\n### `-p base` (**default**)\n\n```\nimshow examples/*.jpg\nimshow examples --recursive  # auto-search image files\n```\n\n### `-p tile`\n\n```\nimshow examples/*.jpg -p tile --col 3 --row 3\nimshow examples/*.jpg -p tile --col 3\n```\n\n<img src=\"https://github.com/wkentaro/imshow/raw/main/.readme/tile_0.png\" height=\"200\"> <img src=\"https://github.com/wkentaro/imshow/raw/main/.readme/tile_1.png\" height=\"150\">\n\n### `-p mark`\n\n```\nimshow examples/*[0-9].jpg -p mark --mark-file examples/mark.txt\n```\n\n<img src=\"https://github.com/wkentaro/imshow/raw/main/.readme/mark_0.png\" height=\"150\"> <img src=\"https://github.com/wkentaro/imshow/raw/main/.readme/mark_1.png\" height=\"150\"> <img src=\"https://github.com/wkentaro/imshow/raw/main/.readme/mark_2.png\" height=\"150\"> \n\n## How to create custom plugin\n\nYou can pass a Python file that contains `class Plugin(base.Plugin)` to `--plugin, -p` to customize the behaviour of Imshow. Below example shows a countdown from 10 to 0 displayed as images.\n\n<img src=\"https://github.com/wkentaro/imshow/raw/main/.readme/countdown_0.png\" height=150> <img src=\"https://github.com/wkentaro/imshow/raw/main/.readme/countdown_1.png\" height=150> <img src=\"https://github.com/wkentaro/imshow/raw/main/.readme/countdown_2.png\" height=150>\n\nSee [`plugins/base.py`](https://github.com/wkentaro/imshow/blob/main/imshow/plugins/base.py) for the most basic example of scanning image files and displaying them.\nFor more examples, check [`plugins` folder](https://github.com/wkentaro/imshow/blob/main/imshow/plugins).\n\n```bash\nimshow examples/*.jpg --plugin examples/countdown_plugin.py --number 10\n```\n\n```python\nimport numpy as np\nimport imgviz\nfrom imshow.plugins import base\n\n\nclass Plugin(base.Plugin):\n    @staticmethod\n    def add_arguments(parser):\n        # define additional command line options\n        parser.add_argument(\n            \"--number\", type=int, default=10, help=\"number to count down from\"\n        )\n\n    number: int\n\n    def __init__(self, args):\n        self.number = args.number\n\n    def get_items(self):\n        # convert command line options into items to visualize.\n        # each item represent the chunk that is visualized on a single window.\n        yield from range(self.number, -1, -1)\n\n    def get_image(self, item):\n        # convert item into numpy array\n        image = np.full((240, 320, 3), 220, dtype=np.uint8)\n\n        font_size = image.shape[0] // 2\n        height, width = imgviz.draw.text_size(text=f\"{item}\", size=font_size)\n        image = imgviz.draw.text(\n            src=image,\n            text=f\"{item}\",\n            yx=(image.shape[0] // 2 - height // 2, image.shape[1] // 2 - width // 2),\n            color=(0, 0, 0),\n            size=font_size,\n        )\n        return image\n```\n\n## License\n\nMIT\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Flexible and Customizable Image Display",
    "version": "0.2.3.post0",
    "project_urls": {
        "Homepage": "https://github.com/wkentaro/imshow"
    },
    "split_keywords": [
        "image",
        "visualization"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7f29bf41f353fc94a21374fab7e544b6f07dffe7053cd5ed040d5ce8da0c2f21",
                "md5": "0f2e67759e045b19b282f5e40aa6e4ee",
                "sha256": "9349df65161fe642f9acaa5a894d5c8c8e7966e4663bbbe7bd0a8477a8800199"
            },
            "downloads": -1,
            "filename": "imshow-0.2.3.post0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0f2e67759e045b19b282f5e40aa6e4ee",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11064,
            "upload_time": "2024-01-19T12:21:39",
            "upload_time_iso_8601": "2024-01-19T12:21:39.883887Z",
            "url": "https://files.pythonhosted.org/packages/7f/29/bf41f353fc94a21374fab7e544b6f07dffe7053cd5ed040d5ce8da0c2f21/imshow-0.2.3.post0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "11ddc5e79491c8de739d533248dc334d2e454de6e36ab73d45d2713984dc69c0",
                "md5": "11ee9d24cf1abed9df1fb606e061cd7e",
                "sha256": "869bc2c23de59495bbd17057ade1311b7a452a749af2ab50750c29cafb66a913"
            },
            "downloads": -1,
            "filename": "imshow-0.2.3.post0.tar.gz",
            "has_sig": false,
            "md5_digest": "11ee9d24cf1abed9df1fb606e061cd7e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 21569731,
            "upload_time": "2024-01-19T12:21:55",
            "upload_time_iso_8601": "2024-01-19T12:21:55.675468Z",
            "url": "https://files.pythonhosted.org/packages/11/dd/c5e79491c8de739d533248dc334d2e454de6e36ab73d45d2713984dc69c0/imshow-0.2.3.post0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-19 12:21:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wkentaro",
    "github_project": "imshow",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "imshow"
}
        
Elapsed time: 0.21595s