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

WebP Support #190

Closed
ajc2 opened this issue Dec 3, 2019 · 7 comments
Closed

WebP Support #190

ajc2 opened this issue Dec 3, 2019 · 7 comments

Comments

@ajc2
Copy link

ajc2 commented Dec 3, 2019

It seems like WebP is going to be the format of the future, since it outperforms PNG for the same result, so omitting it from maim is a bit unfortunate. Client support is pretty wide, but I'm not really sure how many open libraries there are for it. Is that why?

@naelstrof
Copy link
Owner

It should be pretty easy to implement, I haven't touched maim in quite a while though since Wayland was trying to supersede and eliminate all existing screenshot apps due to security reasons.

That was a couple years ago, and now it seems like they've added a form of implicit authentication with "Portals". Described here: https://gitlab.freedesktop.org/wayland/wayland/issues/32

It still requires a lot of work on my end, but if I can get it to work the way I expect I'll definitely add WebP support.

@llenck
Copy link
Contributor

llenck commented Jun 19, 2021

I think this can be closed now.

@foxpy
Copy link
Collaborator

foxpy commented Jun 19, 2021

Resolved by #233.

@foxpy foxpy closed this as completed Jun 19, 2021
@L1pE
Copy link

L1pE commented Jun 20, 2021

I can't get webp images to paste through xclip as per the example in the readme (while replacing mimetype and even adding --format=webp). Could it be on xclip's side?

@foxpy
Copy link
Collaborator

foxpy commented Jun 21, 2021

I can't get webp images to paste through xclip as per the example in the readme (while replacing mimetype and even adding --format=webp). Could it be on xclip's side?

First of all, maim generates perfect webp at least on my machine. You can easily validate it for yourself:

$ maim --format=webp | file -
/dev/stdin: RIFF (little-endian) data, Web/P image, VP8 encoding, 1366x768, Scaling: [none]x[none], YUV color, decoders should clamp

When I pipe webp image into xclip like this: maim --format=webp | xclip -selection clipboard -t image/webp, things get funny. Telegram Desktop apparently decodes whatever you paste into it and manually encodes into jpeg or png. At least it understands the webp part and decodes it as expected. Firefox apparently does not understand/support image/webp MIME type in its clipboard API and pastes whole image as plain text. Haven't tested other applications but this thing seems to be working well on my machine © ® ™, only applications support for webp is limited.

xclip seems to be working well, too. You can validate xclip like this:

$ maim --format=webp | xclip -selection clipboard -t image/webp
$ xclip -o -selection clipboard | file -
/dev/stdin: RIFF (little-endian) data, Web/P image, VP8 encoding, 1366x768, Scaling: [none]x[none], YUV color, decoders should clamp

@L1pE
Copy link

L1pE commented Jun 21, 2021

I see, my bad, had only tested one program (Wire chat) and I knew it accepted webp images so I didn't expect it to choke on the mimetype, which it does by not reacting in any way to paste attempts. But I can confirm my xclip output looks similar to yours and it also pastes on e.g. GIMP with no problems. Thanks for the info.

@foxpy
Copy link
Collaborator

foxpy commented Jun 21, 2021

I see, my bad, had only tested one program (Wire chat) and I knew it accepted webp images so I didn't expect it to choke on the mimetype, which it does by not reacting in any way to paste attempts. But I can confirm my xclip output looks similar to yours and it also pastes on e.g. GIMP with no problems. Thanks for the info.

Yeah, webp is still relatively new (even though it is based on old VP8 video codec!) and most software is not prepared to encounter webp images.

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

No branches or pull requests

5 participants