Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iTerm2 inline image protocol support #50

Merged
merged 30 commits into from
Jun 13, 2022
Merged

iTerm2 inline image protocol support #50

merged 30 commits into from
Jun 13, 2022

Conversation

AnonymouX47
Copy link
Owner

@AnonymouX47 AnonymouX47 commented Jun 8, 2022

Implementing #48

  • Implements support for the iTerm2 inline image protocol.
  • Adds the iterm2 render style.
    • Adds .image.iterm2 submodule.
    • Adds ITerm2Image class.
  • Adds iterm2 choice for -S | --style.
  • Adds term_image.TermImageWarning.
  • Adds --itn/--iterm2-native and --itn-max/--iterm2-native-maxsize style-specific CL options for 'iterm2' native animation.
  • Restores support checks in subprocesses.

- Add: Added `GraphicsImage._get_minimal_render_size()`.
  - Moved from `KittyImage._render_image()`.
- Change: Moved methods applicable to multiple graphics style from `KittyImage` into `GraphicsImage`.
  - `_get_render_size()`
  - `_pixels_cols()`
  - `_pixels_lines()`
- Add: Added `.image.iterm2` submodule.
- Add: Added `.image.iterm2.ITerm2Image`.
- Add: Implemented support detection for `iterm2` render style.
- Add: Added `.exceptions.ITerm2ImageError`.
@AnonymouX47 AnonymouX47 added documentation Improvements or additions to documentation enhancement New feature / Improvement suggestion or request lib Related to the library (Not to be used anymore) cli Related to the image viewer's CLI (Not to be used anymore) tui Related to the image viewer's TUI (Not to be used anymore) labels Jun 8, 2022
@AnonymouX47 AnonymouX47 added this to the 0.4.0 milestone Jun 8, 2022
- Add: Implemented "lines" and "whole" render methods for `iterm2` render style.
- Add: Added `_render_method`, `_render_methods`, `_default_render_method` and `_render_image()` to `ITerm2Image`.
- Updated `ITerm2Image` docstring.
- Add: Added `ITerm2Image._clear_images()` to clear on-screen images on Konsole.
- Add: Added `ITerm2Image._handle_interrupted_draw()`.
- For some styles, support checks also involve terminal identification which is required for certain workarounds.

This partially reverts commit f4a1df1.
- Add: Now exporting `ITerm2Image` from `.image`.
- Add: Added `iterm2` style to the list of auto-selected styles.
- Add: Added `ITerm2Image` to the docs.
- Change: Updated `ITerm2Image` docstring.
- Add: Added "iterm2" choice for `-S/--style`.
- Fix: Implemented a workaround for "whole" render method to work on Wezterm and iTerm2.
- Fix: Implemented a workaround to erase text under images on Wezterm.
- Add: Added `erase` style-specific parameter.
- Add: Added `draw()`, `_style_args` and `_display_animated()` to `ITerm2Image`.
- Add: Implemented support for style-specific format specification.
- Add: Added `.image.iterm2.FORMAT_SPEC`.
- Add: Added format spec for `erase` style arg.
- Change: Updated docstrings.
- Fix: Corrected behaviour of `erase=True` with animations.
  - Now using the correct formatted image height.
- Add: Added `native` style parameter.
- Change: Updated `draw()`, `_display_animated()` and `_render_image()` in `ITerm2Image`.
- Change: Updated docstrings.
@AnonymouX47
Copy link
Owner Author

So far...

On WezTerm:
Screenshot_2022-06-09_02-15-29

On Konsole:
Screenshot_2022-06-09_15-57-19

@AnonymouX47 AnonymouX47 mentioned this pull request Jun 9, 2022
11 tasks
- Add: Added `stall_anim` style parameter.
- Change: `ITerm2ImageError` is raised for native animation of WEBP images since it's not supported on any of the tested terminal emulators.
- Change: Updated docstrings.
- Add: Added `method` style-specific parameter.
- Add: Added format spec for `method` and `native` style-specific parameters.
- Add: Render method can now be set per render.
Conflicts:
	term_image/image/kitty.py
- Change: Corrected the overriden value of *stall_native* (to the default) when *animate* is `False`.
- Change: Removed *animate* explicit parameter in `ITerm2Image.draw()`.
- Change: Updated docstrings.
- Change: Renamed `erase` to `mix` and reversed the logic.
- Change: Modified style format spec accordingly.
- Change: Changed 'iterm2' text inter-mix policy to erase by default.
- Change: Updated docstrings.
- Add: Added a parser for 'iterm2' style-specifc options.
- Add: Added 'iterm2' native animation support with `--itn/--iterm2-native` CL option.
- Add: Added render method selection of 'iterm2' render style.
- Add: Handled style-specific errors.
- Fix: Prevented resending of animation data to `AnimRenderManager` upon consecutive resizes.
- Add: Added style-specific format specification for 'iterm2' render style.
- Add: Added workarounds for 'iterm2' animation in WezTerm.
- Add: Added ``term_image.TermImageWarning``.
- Change: Updated package top-level docstring.
- Change: Updated top-level definitions docs.
- Add: ``ITerm2ImageError`` is raised when rendering a native animation with a PIL-sourced image and its format cannot be determined.
- Add: Added a maximum size for native animation image data.
- Add: ``TermImageWarning`` is issued when rendering a native animation with image data size above the set maximum.
- Change: Now reading image data for native animation directly from file when possible.
  - Significant speedup.
- Change: Lifted animation rendered/padding height limitations on native animations.
- Change: Updated docstrings.
- Add: Added `--itn-max/--iterm2-native-maxsize` CL option.
- Add: Handled native animations with data size above the maximum.
  - Set a warning filter to turn `TermImageWarning` issued from `.image.iterm2` into an exception and handled the exception.
- Change: Refactored 'iterm2' render method selection code.
- Change: Updated CLI help text.
- Change: Image data is now read directly from file when possible and reasonable.
  - Significant speedup, especially for transparent renders.
- Change: Increased quality of JPEG encoding used for non-transparent renders.
  - Definitely increases image data size but still much better compressed than with PNG.
@AnonymouX47 AnonymouX47 merged commit 76c82e0 into main Jun 13, 2022
@AnonymouX47 AnonymouX47 deleted the iterm2 branch June 13, 2022 23:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the image viewer's CLI (Not to be used anymore) documentation Improvements or additions to documentation enhancement New feature / Improvement suggestion or request lib Related to the library (Not to be used anymore) tui Related to the image viewer's TUI (Not to be used anymore)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant