--text follows this line--
It appears that images in tooltip-mode tooltips is currently broken on
most platforms besides windows. The following snippet should provide an
example:
(defun my-download-as-string (url)
"Download file from URL and return it as string."
(let ((image-buf (url-retrieve-synchronously url)))
(when image-buf
(with-current-buffer image-buf
(goto-char (point-min))
(when (looking-at "HTTP/")
(delete-region (point-min)
(progn (re-search-forward "\n[\n]+")
(point))))
(buffer-substring-no-properties (point-min) (point-max))))))
(defun my-download-image (url)
"Download URL as image."
(create-image (my-download-as-string url) (image-type-from-file-name url) t))
(with-current-buffer (get-buffer-create "*TooltipTest*")
(tooltip-mode)
(insert
(propertize "Facepalm" 'help-echo
(propertize " " 'display
(my-download-image "https://upload.wikimedia.org/wikipedia/commons/thumb/3/3b/Paris_Tuileries_Garden_Facepalm_statue.jpg/300px-Paris_Tuileries_Garden_Facepalm_statue.jpg"))))
(display-buffer (current-buffer)))
Just `eval-buffer` then hover your mouse over `Facepalm` in the new
buffer.
Emacs versions 26.2 26.3 and 28.0.50 were tested on NixOS, Ubuntu, OSX
and Windows.
On Windows a tooltip displays an image. On Linux (NixOS, Ubuntu) and OSX
only a small empty tooltip is presented.
One package I was able to identify that uses this behavior is Dired+
This feature is also useful in general to maintain the readability of
org-mode documents for example.