Copying an image to the clipboard from command lin

2019-05-07 16:18发布

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 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 ?

1条回答
一夜七次
2楼-- · 2019-05-07 16:40

Have a look at xclip, especially at xclip-copyfile and xclip-pastefile.

  xclip -i < yourfile.png
查看更多
登录 后发表回答