AnonymouX47 / term-image

Display images in the terminal with python
https://term-image.readthedocs.io
MIT License
216 stars 9 forks source link

Strange visual artifacts on OSX #53

Closed Sam-Cleveland closed 2 years ago

Sam-Cleveland commented 2 years ago

Hey, I just installed term-image on OSX and upon trying multiple images, I seem to get visual artifacts upon loading images (especially those with transparent backgrounds). I have tried a couple different images (in both png and jpeg format) and the issue seems to persist. It's possible that this is some user error but I haven't done anything besides install it and use it right off the bat. I'll include the images along with this issue to see if others can get these to render.

Steps to reproduce the behavior:

  1. Install term-image via zsh Terminal (pip3 install term-image)
  2. Open image (term-image ~/Downloads/image.png)

Screenshots

Screen Shot 2022-06-17 at 3 27 14 PM

Desktop (please complete the following information, if applicable):

Package info:

Original images used: image image

AnonymouX47 commented 2 years ago

Thanks for reporting :smiley:

Anyways...

zsh terminal

zsh is a shell, not a terminal emulator. Examples of a terminal emulator are the MacOS Terminal, iTerm2, etc.

From what I can see in the output, it's obvious the terminal emulator doesn't have proper truecolor support (or it's disabled). Please, let me know exactly which terminal emulator you used here and we can figure things out from there.

N.B: I do not have immediate access to a Mac. So, even if I knew the terminal emulator, probing the issue might take a while on my end. Also, I tested on iTerm2 not too long ago and it worked just fine. So, I'm assuming this is not iTerm2.

AnonymouX47 commented 2 years ago

Screenshot_2022-06-18_14-17-51

Both images were properly displayed here on the Kitty terminal emulator...

AnonymouX47 commented 2 years ago

Please, check the requirements and ensure the third one is satisfied.

Sam-Cleveland commented 2 years ago

Please, let me know exactly which terminal emulator you used here and we can figure things out from there.

This was on the native OSX Terminal

N.B: I do not have immediate access to a Mac. So, even if I knew the terminal emulator, probing the issue might take a while on my end. Also, I tested on iTerm2 not too long ago and it worked just fine. So, I'm assuming this is not iTerm2.

I'd be glad to assist with any testing for OSX

AnonymouX47 commented 2 years ago

This was on the native OSX Terminal

Guessed as much... From previous knowledge, I knew it doesn't have truecolor (24-bit color) support and I looked it up again to be sure. From the third paragraph on this wiki page, I can infer that the farthest the terminal goes with colors is 256 (8-bit) colors.

This means the current implementation of image rendering in this package will not work on the terminal, though some other 256color terminals still try to approximate 24-bit colors.

I have plans to implement 256color support (coming in v0.5.0 with other features), as one of the major goals of this project is to be usable on any terminal with any level of support. Till 256color support is implemented (and even after :)), the only option is to use a terminal emulator with truecolor support.

Also, I'll release v0.4.0 in a few days... with support for Kitty and iTerm2 terminal graphics protocols (See #40 and #48). So, using a more modern terminal emulator is the best option in the end. :grinning:

I'd be glad to assist with any testing for OSX

I'd really appreciate that. Thanks so much. :smiley: