The Complete Computing Environment

Capturing an Emacs SVG screenshot

As mentioned by Clement on Mickey's blog post, Emacs 27.1 can use Cairo to take SVG screenshots of itself. The result is, of course, resizeable without aliasing, and looks great in a Web browser.
(defun screenshot-svg ()
  "Save a screenshot of the current frame as an SVG image.
Saves to a temp file and puts the filename in the kill ring."
  (let* ((filename (make-temp-file "Emacs" nil ".svg"))
         (data (x-export-frames nil 'svg)))
    (with-temp-file filename
      (insert data))
    (kill-new filename)
    (message filename)))