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

Re-consider SVG support for imgcat #6042

Open
LitoMore opened this issue Aug 26, 2024 · 2 comments
Open

Re-consider SVG support for imgcat #6042

LitoMore opened this issue Aug 26, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@LitoMore
Copy link
Contributor

LitoMore commented Aug 26, 2024

I just read the previous discussion on #896. iTerm2 does support SVG images, but not exactly.

iTerm2 cannot parse those SVG images with decimal numbers, such as viewBox="0 0 1.5 2", width="20.5", and height="1.333333".

But for integer sizes, it works well.

Here are some examples on iTerm2 (it uses this imgcat):

imgcat -u 'https://cdn.simpleicons.org/wezterm'
imgcat -u 'https://cdn.simpleicons.org/wezterm?viewbox=auto'
imgcat -u 'https://cdn.simpleicons.org/wezterm?viewbox=auto&size=48'

This means users can insert their own favorite tech/social icons into terminal:

echo "$(imgcat -u 'https://cdn.simpleicons.org/wezterm?viewbox=auto&size=32') My favorite terminal emualtor"

What do you think?


Update

I also made a new approach with icon font. See this discussion below:

@LitoMore LitoMore added the enhancement New feature or request label Aug 26, 2024
@tbung
Copy link
Contributor

tbung commented Sep 6, 2024

You could do something like

Screenshot from 2024-09-06 21-16-05

magick -background None <(wget -q -O- 'https://cdn.simpleicons.org/wezterm?viewbox=auto&size=32') png:- | wezterm imgcat

in the mean time.

@wez
Copy link
Owner

wez commented Sep 15, 2024

The other technical concerns I raised on the earlier issue still also apply.

I don't think that wezterm's terminal emulation layer should have an embedded SVG rasterizer for a variety of reasons; the biggest is that svg has a large and complex implementation that is difficult to support fully, and will be a source of issues and support burden for me when someone inevitably complains about discrepancies in rasterization (I get enough of those already for the main terminal functionality!), or represent an increased attack surface if someone comes up with some kind of malicious svg payload.

Aside from being less convenient, I see no real issue with requiring the user to translate the SVG to one of the many widely used and supported bitmap formats with other available utilities that are designed for that purpose.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants