[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Screenshots, frame shots straight from Emacs

From: Hongyi Zhao
Subject: Re: Screenshots, frame shots straight from Emacs
Date: Fri, 23 Jul 2021 08:52:35 +0800

On Wed, Jun 23, 2021 at 5:33 PM Jean Louis <> wrote:
> 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)))

Thank you very much for your courtesy. I like screenshot is due to its
intuitive and simplicity compared to wording in many scenarios. Below
is some additional requirements I want to have with a decent
screenshot method:

1. Have the delay feature, so that I can do some operations before the
screenshot is captured, say, click on mouse button, open a dropdown
menu, and so on.
2. Have the post-processing feature, which can be used for some touch
ups on the generated screenshot subsequently.

I am not sure whether the recommended method here has these characteristics.

Assoc. Prof. Hongyi Zhao <>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province

reply via email to

[Prev in Thread] Current Thread [Next in Thread]