习惯使用cmd+shift+a微信截图,所以自己写了一个函数从粘贴板里的复制截图并保存到文件
但很疑惑这样生成的图片可以在emacs里浏览,也可以使用本地照片打开,却不能用浏览器查看,必须得本地照片打开并重新导出才行
另外这样生成的图片会很大,正常截图就100KB左右,使用这个函数生成的文件都大于1MB大小,有大佬研究过这个问题吗? 系统是macos+emacs-mac27.2
(defun maple/org-download-yank()
(interactive)
(let ((file org-download-screenshot-file)
(image (get-text-property 0 'display (current-kill 0))))
(if (or (not (consp image)) (not (eq (car image) 'image)))
(org-download-yank)
(with-temp-buffer
(insert (plist-get (cdr image) :data))
(let ((coding-system-for-write 'no-conversion))
(write-region nil nil file)))
(when (file-exists-p file)
(org-download-image file)
(delete-file file))))))