[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Screenshots, frame shots straight from Emacs
From: |
Jean Louis |
Subject: |
Screenshots, frame shots straight from Emacs |
Date: |
Wed, 23 Jun 2021 12:31:10 +0300 |
User-agent: |
Mutt/2.0.7+183 (3d24855) (2021-05-28) |
As you like screenshots, here is one way to generate Emacs frame shots
straight from Emacs without using external programs:
(defvar frameshot-directory "~/Media/Pictures/Screenshots/"
"Default directory for frame shots")
(defvar frameshot-format 'png
"Default frame shot format, could be 'jpg or 'svg, inspect the
function `x-export-frames'")
(defun frameshot ()
"Save Emacs frame as frame shot.
Directory is determined by variable `frameshot-directory' and if
not defined, it will be saved in the `$HOME' directory."
(interactive)
(let* ((image (x-export-frames nil (or frameshot-format 'png)))
(base-directory (or frameshot-directory (getenv "HOME")))
(directory (concat (file-name-as-directory base-directory)
(format-time-string "%Y/%m/%Y-%m-%d/")))
(file (concat directory (format-time-string "Screenshot-%Y-%m-%d-%T.")
(symbol-name frameshot-format))))
(make-directory directory t)
(with-temp-file file
(insert image))
(find-file directory)
(message "Frame shot saved as `%s'" file)))
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/
- The convenient method to check/inspect/retrieve the definition/usage of any commands/symbols/operators used in elisp code., Hongyi Zhao, 2021/06/19
- Re: The convenient method to check/inspect/retrieve the definition/usage of any commands/symbols/operators used in elisp code., Omar Polo, 2021/06/19
- Re: The convenient method to check/inspect/retrieve the definition/usage of any commands/symbols/operators used in elisp code., Hongyi Zhao, 2021/06/19
- Re: The convenient method to check/inspect/retrieve the definition/usage of any commands/symbols/operators used in elisp code., Omar Polo, 2021/06/19
- Re: The convenient method to check/inspect/retrieve the definition/usage of any commands/symbols/operators used in elisp code., Hongyi Zhao, 2021/06/19
- Re: The convenient method to check/inspect/retrieve the definition/usage of any commands/symbols/operators used in elisp code., Omar Polo, 2021/06/23
- Re: The convenient method to check/inspect/retrieve the definition/usage of any commands/symbols/operators used in elisp code., Hongyi Zhao, 2021/06/23
- Re: The convenient method to check/inspect/retrieve the definition/usage of any commands/symbols/operators used in elisp code., Hongyi Zhao, 2021/06/23
- Screenshots, frame shots straight from Emacs,
Jean Louis <=
- Re: Screenshots, frame shots straight from Emacs, Emanuel Berg, 2021/06/25
- Re: Screenshots, frame shots straight from Emacs, Jean Louis, 2021/06/25
- Re: Screenshots, frame shots straight from Emacs, Emanuel Berg, 2021/06/25
- Re: Screenshots, frame shots straight from Emacs, Jean Louis, 2021/06/28