https://github.com/lainq/img
A python library to display images in the terminal
https://github.com/lainq/img
cli image images jpeg png python terminal
Last synced: 10 months ago
JSON representation
A python library to display images in the terminal
- Host: GitHub
- URL: https://github.com/lainq/img
- Owner: lainq
- License: mit
- Created: 2021-09-22T08:39:21.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-25T09:53:50.000Z (about 4 years ago)
- Last Synced: 2025-07-17T13:44:30.767Z (11 months ago)
- Topics: cli, image, images, jpeg, png, python, terminal
- Language: Python
- Homepage: https://pranavbaburaj.github.io/img/
- Size: 108 KB
- Stars: 65
- Watchers: 4
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
## Installation
The package can be installed via `pip`
```py
pip install terminal-img
```
## Quick Start
The library is really simple to get started with. Here's is an example of how you display an image
```py
from image import DrawImage
image = DrawImage.from_file("image.png")
image.draw_image()
```
> You can also use a url if you dont have the file locally stored
```py
image = DrawImage.from_url("url")
image.draw_image()
```
> The library can also be used with PIL images
```py
from PIL import Image
from image import DrawImage
img = DrawImage(Image.open("img.png"))
img.draw_image()
```
#### CLI
```
img
```
## Methods
#### `image.DrawImage`
- `image`: The PIL image
- `size`(_`Optional[Tuple]`_) : The size of the image to be displayed. Default: 24, 24
#### `image.DrawImage.from_file`
- `filename`: The name of the file containing the image
- `size`(_`Optional[Tuple]`_) : The size of the image to be displayed. Default: 24, 24
#### `image.DrawImage.from_url`
- `url` : The url of the image
- `size`(_`Optional[Tuple]`_) : The size of the image to be displayed. Default: 24, 24
Special thanks to [@AnonymouX47](https://github.com/AnonymouX47) ❤