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

Rendering improvements #54

Merged
merged 14 commits into from
Jun 23, 2022
Merged

Rendering improvements #54

merged 14 commits into from
Jun 23, 2022

Conversation

AnonymouX47
Copy link
Owner

@AnonymouX47 AnonymouX47 commented Jun 19, 2022

  • Changes image resampling method from BICUBIC to BOX.
  • Improves transparent renders in text-based styles.
  • Implements workaround for un-rendered BG colors with 'block' render style on the kitty terminal.
  • Implements auto background color (using the terminal's default BG color for transparent images)
  • Optimizes image render data computation and image formatting.
  • Adds tests for BaseImage._get_render_data().

- Change: Changed image resampling method from `BICUBIC` to `BOX`.
  - Original image pixels are much better preserved and blurriness is reduced when upsaling.
  - Reduced blurriness when downscaling.
  - Minor performance increase for resizing.
- Change: Updated the changelog.
@AnonymouX47 AnonymouX47 added enhancement New feature / Improvement suggestion or request lib Related to the library (Not to be used anymore) labels Jun 19, 2022
@AnonymouX47 AnonymouX47 added this to the 0.4.0 milestone Jun 19, 2022
- Add: `BaseImage._get_render_data()` now blends the image with the terminal's BG color whenever alpha values are rounded.
- Change: Changed the default value of the *round_alpha* parameter of `BaseImage._get_render_data()` to `False`, which is the norm.
- Fix: Cell BG colors equal to the terminal's default BG color are now slightly adjusted to ensure images are properly drawn on Kitty.
- Add: Added `BlockImage._is_on_kitty()` to detect if the active terminal is a kitty terminal.
- Change: Updated `BlockImage` tests.
@AnonymouX47 AnonymouX47 force-pushed the rendering-improvements branch from f59cc00 to 973cede Compare June 19, 2022 00:54
- Fix: Corrected the description of disabled transparency.
- Add: Implemented the use of the terminal's default BG color for image BG color.
  - "#" is now a valid value for the *alpha* argument of `BaseImage.draw()`.
  - Incorporated changes into the CLI and TUI.
- Change: Modified `BaseImage._get_render_data()`.
- Change: Extended the common format specification.
- Change: Updated docstring of `BaseImage.draw()`.
- Change: Updated format specification docs.
- Change: Updated the description of `-b/--alpha-bg`.
@AnonymouX47 AnonymouX47 force-pushed the rendering-improvements branch from c36ce69 to 3fa9842 Compare June 20, 2022 23:16
@AnonymouX47 AnonymouX47 added fix Fixes a bug block Related to the 'block' render style common Related to the interface common to all render styles text Related to the interface common to text-based render styles labels Jun 20, 2022
@AnonymouX47 AnonymouX47 force-pushed the rendering-improvements branch from 3fa9842 to 58fe227 Compare June 22, 2022 07:09
- Change: Significantly improved formatting performance when padding width is less than rendered width.
  - Now runs in constant time.
  - No operation is performed on the rendered image.
- Change: Improved formatting performance when padding width is greater than rendered width.
  - The rendered image is no longer splitted and joined.
  - Reduced the number of copy operations performed on the rendered image.
  - ~1.7x faster.
- Fix: Corrected alpha threshold field of the format specifier for the TUI.

Broke in 112986e.
- Fix: Alpha pixel data is now correctly rounded when *pixel_data* is `False`.
- Change: Optimized processing of image render data when image mode and/or size is/are already in the required form.
  - Conversion is not performed when the image is already in the target mode.
  - An image is not resized when it already has the target size.
- Change: Cleaned up code.
  - `(width, height)` -> `size`.
- Add: Added tests for `BaseImage._get_render_data()`.
Conflicts:
	tests/test_kitty.py
@AnonymouX47 AnonymouX47 added the test Related to the test suite label Jun 23, 2022
@AnonymouX47 AnonymouX47 merged commit 068e61b into main Jun 23, 2022
@AnonymouX47 AnonymouX47 deleted the rendering-improvements branch June 23, 2022 18:40
AnonymouX47 added a commit that referenced this pull request Jun 24, 2022
- Fix: Fixed render data computation optimization introduced in #54, commit 6137061.
- Add: Added *frame* parameter to `BaseImage._get_render_data()`.
- Add: Added tests for render data clean up.
- Change: PIL images are now closed much more agressively for better memory management.
- Change: Updated render data tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
block Related to the 'block' render style common Related to the interface common to all render styles enhancement New feature / Improvement suggestion or request fix Fixes a bug lib Related to the library (Not to be used anymore) test Related to the test suite text Related to the interface common to text-based render styles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant