You can use scrot with - for standard output, but it will default save a png file. Just add:
scrot -q 100 --silent - |
Should be exactly what it was looking for.
UPDATE: To do this with versions below 1.7, as it does not accept - as stdout, will be a bit more tricky. Here's a shell script:
#!/bin/bash
# Create a temp working directory
temp_file="$HOME/screenshot_$(date +"%Y_%m_%d-%H_%M_%S").png"
# Take a screenshot to the temp file
scrot -zfq 100 --silent "$temp_file"
# Copy the image file to the clipboard using xclip
xclip -selection clipboard -t image/png -i "$temp_file"
echo -e "\nScreenshot saved to:\n"$temp_file"\n"
exit 0
With xclip
, it's ready to paste/output. Piping to xsel
etc. should work the same.
Save it to screenshot.sh
Then, chmod +x screenshot.sh
Finally, run ./screenshot.sh
Tip: Use an alias to run scripts in a single command.
How To Create BASH Aliases
alias sshot='bash -c "/path/to/script/screenshot.sh"'
Now you can take a screenshot by simply typing: sshot