-
Notifications
You must be signed in to change notification settings - Fork 75
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
Image stored as text in the clipboard #128
Comments
I have this i3 keybinding for the same purpose and it's been working fine for me:
I think the last released version of xclip has some bugs dealing with large screenshots though. This has been fixed but there hasn't been a release (I think?). If you're on arch you might want to try |
@mil-ad I tried with Ubuntu. I will try to compile later. |
I compiled from source code and the problem remains. |
The script xclip-copyfile doesn't work either. |
The screenshot you show has JPEG data in it. I don't know about other sites, but gmail requires the data to be in PNG format. Maybe try piping through 'convert - png:-' |
@hackerb9 That is Thunderbird, not the Gmail web interface. After use |
That could be the problem. I submitted the fix for the large files problem a year ago, but then things came up and I lost track of xclip. I don't know if a new release has been made since then. If I recall correctly, we can find out pretty easily. Try this:
Also, could you please see if pasting a PNG image into the comments here works? (Not too large, please). I just tried it and it worked for me with xclip version 0.13. If that works for you, then it must be that Thunderbird is rejecting the MIME type we offered it. Try copying an image using right-click and then running
That will list what MIME types are being offered for Thunderbird to select from. |
@hackerb9 I'm able to paste an image here in GitHub. The problem is when I try to paste in Thunderbird compose screen. Sometimes I have to send selection of captures to other people over email. |
Great! Then I think we've narrowed down the problem. Thunderbird is picky about what filetypes it will use. If it doesn't see a particular image format, it falls back to asking for the selection as text (which, of course, fails). Let's figure out which MIME type Thunderbird is looking for so you can convert your data to something that makes it happy. Use the right-click copy on an image and use that
[P.S. I believe there used to be a "clipboard manager" which would could convert any image on the fly based on whatever type was requested. I can't find it now. Maybe someone can refresh my memory. ] |
Oh, yeah, I think it was |
I checked the mimetypes of an image on the clipboard and got this:
But I had an out-side-of-the-box thinking and pasted an image on Thunderbird and, after that, I copied again and checked one more time the mimetypes of the clipboard. I got this:
Convert to BMP using any mimetype didn't work, the same for JPEG or PNG. I think the secret is one of this text formats, but I don't know how to convert to it. |
You copied the image from within Thunderbird? And it didn't show any images available? If so, Thunderbird isn't seeing it as an image at all, it must be an HTML reference of some sort. What is the output of
If that's not useful, what about the moz targets? I believe "url-priv" can also specify a file on your local computer. |
Oh, I had meant convert to each filetype and give the appropriate mimetype. It looks like the only other likely image format on your list would be tiff:
|
TIFF also produced gibberish |
Flameshot is just offering to convert the image type for any application that is looking for a specific format. Clipboard managers can do that. I wish xclip could do it without entailing large dependencies on image libraries. |
I just zoomed in on your image and it looks like there was a misspelling "clipboard". Could you try again? |
So, pasting from flameshot when it has those targets worked? Also, when you copy from Thunderbird, without using flameshot, what targets are available? |
Yes, I'm able to paste the content Flameshot put in the clipboard. For this test, I inserted an image using the appropriate menu option in the Thunderbird compose screen, and after that, I copied the image. I got this targets than.
|
Oh, how odd! Thunderbird wants the image to be encoded as an "inline" (base64) image? That would be pretty gross, but doable. I think the conversion would look something like this: ( echo -n '<meta http-equiv="content-type"';
echo -n ' content="text/html; charset=utf-8"><p><img src="';
convert myimage.png inline:-;
echo '">') | xclip -i -sel clipboard -t text/html Still, it seems highly unlikely to me that an inline image is what Thunderbird is insisting on. |
I use i3 (so no GNOME, if it's relevant) and I configured some keystrokes to do screenshots. Some of them are to paste the screenshot directly to the clipboard. This is (one of) the command:
maim --select | xclip -selection clipboard -t image/png
. The idea about it is quite simple: Do a screenshot of some part of the screen and put in the clipboard. The problem is when I paste the image, more specifically in the message compose screen of Thunderbird (my use case, but not limited to that, Firefox acts on the same way), just the pure text of the file is pasted, not the image. If I copy an image directly (like on Firefox, right-click on image and copy) the paste occurs as expected. I found the content of this link about targets is true, as the same for me, and I think could be helpful for someone debugging the problem: https://unix.stackexchange.com/questions/375002/xclip-image-binary-contents-pasted-into-text-fieldsThe text was updated successfully, but these errors were encountered: