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

SVG support #991

Closed
Rolv-Apneseth opened this issue Mar 26, 2023 · 5 comments
Closed

SVG support #991

Rolv-Apneseth opened this issue Mar 26, 2023 · 5 comments
Labels
enhancement New feature or request stale upstream

Comments

@Rolv-Apneseth
Copy link

Summary 💡

When running onefetch --image path/to/file.svg, I get the following error:

Error: Could not load the specified image

Caused by:
    The file extension `."svg"` was not recognized as an image format

While I don't know about the other image back ends, I do know that kitty does support svg files (as confirmed here), so would it be possible to integrate support for these files for onefetch? I can work on this, just need to know if it's possible or something you would even be interested in.

Motivation 🔦

I would like to be able to display an svg file I have for a specific git repo.

@o2sh o2sh added upstream enhancement New feature or request labels Mar 26, 2023
@o2sh
Copy link
Owner

o2sh commented Mar 26, 2023

Thanks for reporting this @Rolv-Apneseth

Seems to be an issue with the image crate, which only supports raster formats: image-rs/image#524 (comment)

The error message comes from this line:

Some(p) => Some(image::open(p).context("Could not load the specified image")?),

@Rolv-Apneseth
Copy link
Author

Hmm I see, maybe it's a bit much for this project or what do you think? Very niche anyways I suppose.

@spenserblack
Copy link
Collaborator

Yeah, quickly going through the image-rs docs and source code, I don't think it's possible for a 3rd-party to register a new format. At least not for image::open (less abstracted usage might still be possible). Though I'd be happy if it turns out I missed something 😆 But this means it won't be easy to support SVGs.

Just speaking generally about image decoding, I think at least partial support for SVGs could be achieved by requiring the user to specify dimensions. So I wouldn't be surprised if a crate existed that implemented the image-rs traits for a type that represents an SVG image.

(We could at least support SVGs as a detected language 😜)

@o2sh
Copy link
Owner

o2sh commented Mar 29, 2023

(We could at least support SVGs as a detected language 😜)

You're right, somehow it was missing from the list of languages in #490 😅

@o2sh
Copy link
Owner

o2sh commented Sep 24, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@o2sh o2sh added the stale label Sep 24, 2023
@o2sh o2sh closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request stale upstream
Projects
None yet
Development

No branches or pull requests

3 participants