Skip to content

Commit

Permalink
Merge pull request #72 from AnonymouX47/separate-lib-viewer
Browse files Browse the repository at this point in the history
Separate the library and the image viewer
  • Loading branch information
AnonymouX47 authored Feb 1, 2023
2 parents 5f8f9c6 + 463c633 commit 2e80a81
Show file tree
Hide file tree
Showing 32 changed files with 118 additions and 7,073 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `write_tty()`

### Removed
- The CLI and TUI.
- `term_image.utils.read_tty()` from the public API ([#70]).
- As much private API usage across the CLI and TUI code ([#70]).

Expand Down
102 changes: 21 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
- [Installation](#installation)
- [Features](#features)
- [Demo](#demo)
- [CLI/TUI Quick Start](#clitui-quick-start)
- [Library Quick Start](#library-quick-start)
- [Quick Start](#library-quick-start)
- [Usage](#usage)
- [Contribution](#contribution)
- [Planned Features](#planned-features)
Expand All @@ -45,6 +44,10 @@
- [Donate](#donate)


> ### :warning: NOTICE!!! :warning:
> The image viewer (CLI and TUI) has been moved to [term-image-viewer](https://github.com/AnonymouX47/term-image-viewer).

## Installation

### Requirements
Expand All @@ -56,7 +59,7 @@
- support for the [iTerm2 inline image protocol](https://iterm2.com/documentation-images.html).
- full Unicode support and ANSI 24-bit color support

**Plans to support a wider variety of terminal emulators are in motion** (see [here](https://term-image.readthedocs.io/en/latest/library/index.html#planned-features)).
**Plans to support a wider variety of terminal emulators are in motion** (see [here](https://term-image.readthedocs.io/en/latest/index.html#planned-features)).

### Steps
The latest **stable** version can be installed from [PyPI](https://pypi.python.org/pypi/term-image) using `pip`:
Expand Down Expand Up @@ -87,20 +90,18 @@ pip install .
### Supported Terminal Emulators
See [here](https://term-image.readthedocs.io/en/latest/installation.html#supported-terminal-emulators) for a list of tested terminal emulators.

If you've tested `term-image` on any other terminal emulator that meets the requirements for any of the render styles,
If you've tested this library on any other terminal emulator that meets the requirements for any of the render styles,
please mention the name (and version) in a new thread under [this discussion](https://github.com/AnonymouX47/term-image/discussions/4).

Also, if you have any issue with terminal support, you may report or check information about it in the discussion linked above.


## Features

### Library features
- Multiple image formats (basically all formats supported by [`PIL.Image.open()`](https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html))
- Multiple image source types: PIL image instance, local file, URL
- Exposes various features of the protocols
- Multiple image render styles (with automatic support detection)
- Support for multiple terminal graphics protocols: [Kitty](https://sw.kovidgoyal.net/kitty/graphics-protocol/), [iTerm2](https://iterm2.com/documentation-images.html)
- Exposes various features of the protocols
- Transparency support (with multiple options)
- Animated image support (including transparent ones)
- Multiple formats: GIF, WEBP, APNG (and possibly more)
Expand All @@ -113,72 +114,19 @@ Also, if you have any issue with terminal support, you may report or check infor
- Well-documented
- and more... :grin:

### CLI/TUI features
- Almost everything the library supports
- Individual/Multiple image display [CLI]
- Browse multiple images and directories (recursively) [TUI]
- Adjustable image grids [TUI]
- Context-based controls [TUI]
- Customizable controls and configuration options
- Smooth and performant experience
- and more... :grin:

### How does this project compare with similar ones?
As far as I know, the only aspect of this project that any other currently existing project can be compared with is the CLI.

I prefer to leave comparisons to the users.


## Demo

Check out the [gallery](https://term-image.readthedocs.io/en/latest/gallery.html).

<details>
<summary>Click to expand</summary>

[TUI Demo Video](https://user-images.githubusercontent.com/61663146/163809903-e8fb254b-a0aa-4d0d-9fc9-dd676c10b735.mp4)

_\*The video was recorded at normal speed and not sped up._

</details>


## CLI/TUI Quick Start

<details>
<summary>Click to expand</summary>

With a local image file
```shell
term-image path/to/image.png
```

With an image URL
```shell
term-image https://www.example.com/image.png
```

With a directory, recursively (not currently supported on Windows)
```shell
term-image -r path/to/dir/
```

If the image is animated (GIF, WEBP), the animation is infinitely looped **by default** but can be stopped with `Ctrl-C`.

**By default, if multiple sources or at least one directory is given, the TUI (Text-based/Terminal User Interface) is launched to navigate through the images (and/or directories).**
Check out the [gallery](https://term-image.readthedocs.io/en/latest/gallery.html) and this [image viewer](https://github.com/AnonymouX47/term-image-viewer) based on this library.

**NOTE:** `python -m term_image` can be used as an alternative to the `term-image` command **(take note of the _underscore_ VS _hyphen_)**.

</details>

## Quick Start

## Library Quick Start
### Creating an instance

<details>
<summary>Click to expand</summary>

### Creating an instance

```python
from term_image.image import from_file

Expand All @@ -201,8 +149,13 @@ img = Image.open("path/to/image.png")
image = AutoImage(img)
```

</details>

### Drawing/Displaying an image to/in the terminal

<details>
<summary>Click to expand</summary>

There are two ways to draw an image to the terminal.

#### 1. The `draw()` method
Expand All @@ -227,25 +180,13 @@ For animated images, only the first method can animate the output, the second on
## Usage

<p align="center"><b>
:construction: Under Construction - There might be incompatible changes between minor versions of
:construction: Under Construction - There will most likely be incompatible changes between minor versions of
<a href='https://semver.org/spec/v2.0.0.html#spec-item-4'>version zero</a>!
</b></p>

**If you want to use `term-image` in a project while it's still on version zero, ensure you pin the dependency version to a specific minor version e.g `>=0.4,<0.5`.**

### Library
See the [tutorial](https://term-image.readthedocs.io/en/latest/library/tutorial.html) for a more detailed introduction and the [reference](https://term-image.readthedocs.io/en/latest/library/reference/index.html) for full descriptions and details of the available features.

### CLI (Command-Line Interface)
Run `term-image --help` to see the full usage info and list of options.

### TUI (Text-based/Terminal User Interface)
The controls are **context-based** and displayed at the bottom of the terminal window.
Pressing the `F1` key (in most contexts) brings up a **help** menu describing the available controls (called *actions*) in that context.

The TUI can be configured by modifying the config file. See the [Configuration](https://term-image.readthedocs.io/en/latest/viewer/config.html) section of the docs.
**If you want to use this library in a project while it's still on version zero, ensure you pin the dependency version to a specific minor version e.g `>=0.4,<0.5`.**

[Here](https://github.com/AnonymouX47/term-image/blob/main/vim-style_config.json) is a config file with Vim-style key-bindings (majorly navigation). *Remember to rename the file to `config.json`.*
See the [tutorial](https://term-image.readthedocs.io/en/latest/tutorial.html) for a more detailed introduction and the [reference](https://term-image.readthedocs.io/en/latest/reference/index.html) for full descriptions and details of the available features.


## Contribution
Expand All @@ -266,11 +207,11 @@ Thanks! :heart:

## Planned Features

Check [here](https://term-image.readthedocs.io/en/latest/library/index.html#planned-features) for the library and [here](https://term-image.readthedocs.io/en/latest/viewer/index.html#planned-features) for the image viewer.
See [here](https://term-image.readthedocs.io/en/latest/index.html#planned-features).

## Known Issues

Check [here](https://term-image.readthedocs.io/en/latest/library/index.html#known-issues) for the library and [here](https://term-image.readthedocs.io/en/latest/viewer/index.html#known-issues) for the image viewer.
See [here](https://term-image.readthedocs.io/en/latest/index.html#known-issues).

## FAQs

Expand All @@ -281,7 +222,6 @@ See the [FAQs](https://term-image.readthedocs.io/en/latest/faqs.html) section of
The following projects have been (and are still) crucial to the development of this project:

- [Pillow](https://python-pillow.org)
- [Urwid](https://urwid.org)

## Donate

Expand Down
163 changes: 0 additions & 163 deletions default_config.json

This file was deleted.

Loading

0 comments on commit 2e80a81

Please sign in to comment.