复制的图像从命令行剪贴板 [英] Copying an image to the clipboard from command line

查看:441
本文介绍了复制的图像从命令行剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ImageMagick的我的屏幕的部分复制到一个临时文件(something.png)。我现在想这个文件的内容直接在命令行粘贴到剪贴板中。

I am using ImageMagick to copy a portion of my screen into a temporary file (something.png). I would now like to paste the contents of this file into the clipboard directly from command line.

到目前为止,我的剧本是这样的:

So far my script looks like this:

#!/bin/bash

TMPFILE=$(mktemp)
FORMAT='.PNG'
SCREENSHOT_FILE=${TMPFILE}${FORMAT}

mv "$TMPFILE" "$SCREENSHOT_FILE"
import "$SCREENSHOT_FILE"
cat "$SCREENSHOT_FILE" | parcellite
rm "$SCREENSHOT_FILE"

Parcellite完全适用于命令行复制和粘贴,但我不能让它与图像工作。我认为这不是parcellite的一个特点。我怎么能这样做呢?

Parcellite works perfectly for command line copying and pasting, but I can’t get it to work with image. I reckon this is not a feature of parcellite. How could I do that then ?

推荐答案

看一看 XCLIP ,尤其是在 XCLIP-copyfile XCLIP-pastefile

  xclip -i < yourfile.png

这篇关于复制的图像从命令行剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆