MacOS: saving images from the clipboard using `pngpaste` is faded and white
copy/pastemacosterminal
When I take a screenshot on macOS, and use pngpaste a1.png to save it, the image is faded:
This only happens when I take a fullscreen screenshot using CMD+SHIFT+3, and not with CMD+SHIFT+4.
Best Answer
Using these instead works fine:
function pngpaste() {
local name="${1}"
ensure-args name @MRET
ensure isDarwin @MRET
[[ "$name" =~ '\.png$' ]] || name+=.png
osascript -e "tell application \"System Events\" to ¬
write (the clipboard as «class PNGf») to ¬
(make new file at folder \"$(pwd)\" with properties ¬
{name:\"${name}\"})"
}
function jpgpaste() {
local name="${1}"
ensure-args name @MRET
ensure isDarwin @MRET
[[ "$name" =~ '\.jpg$' ]] || name+=.jpg
osascript -e "tell application \"System Events\" to ¬
write (the clipboard as JPEG picture) to ¬
(make new file at folder \"$(pwd)\" with properties ¬
{name:\"${name}\"})"
}
This is known issue with the current release of Safari.
But pasting images from the clipboard is now working properly in the Safari Technology Preview which means the fix should be coming to the public release version of Safari shortly.
FYI, You can go ahead and use the tech preview version alongside your regular Safari install without disrupting anything.
EDIT: Safari 10.1 was released today and fixes this issue.
EDIT #2: It seems to only work with some source applications but not others. For example, I can select and copy sections of web pages w/images and paste them into Gmail no problem (Safari to Safari). I can also copy text+images from Evernote to Gmail. But... the same doesn't seem to work when TextEdit or Notes is the source.
I had this problem with High Sierra, Preview, and a DisplayCal profile.
The latest version of DisplayCal, 3.5, has in its release notes:
Mac OS X: Set default profile type to single curve + matrix with black point compensation due to long-standing Mac OS X bugs with any other profile type.
Upgrading DisplayCal and creating new profiles for each of my displays based on the Default profile solved the problem for me. The profile is probably not as descriptive as it could be, but at least Preview/Quick Look work.
Best Answer
Using these instead works fine:
Usage: