image-mode happily shows me the picture, but it never tells me the one bit of information I actually want to know, how big is the thing?, width, height, file size, that sort of thing. You can of course bounce out to a shell and run identify or file, but that feels silly when Emacs already has the image loaded
So I thought, right, this should be a five minute job, just slap something into the header-line on image-mode-hook and be done with it. And it more or less was, although there was a small wrinkle along the way that is worth mentioning, because it caught me out.
Here is what ended up in my init.el:
;;
;; -> image-mode-dimensions
;;
(defun my/image-mode-show-dimensions ()
"Display the open image's pixel dimensions and file size in the header line."
(when (and (deri…
( 2
min )