2026-06-06 Copying images in Emacs

A few weeks ago I was on vacation. Of course I brought back quite a few pictures with me. When I got back, I sat to select some of them to make a gallery for my family and friends. I started with copying all pictures from two mobile phones and a camera to my laptop. Then I wanted to copy a few carefully chosen images to one directory.

To my surprise, Emacs’ Image mode does not have a command to copy the currently viewed image to another directory. Going from Image mode to Dired only to copy (or even just mark) an image and then back to Image mode would be very inconvenient, so I decided to write such a command myself. Fortunately, I started with looking at the documentation of Image mode. It turns out that Emacs has something even better: the image-mode-mark-file (bound to m in Image mode). It will mark the current file in any Dired buffer(s) that display the current file’s directory. This means that I can visit the first image in a directory, move forward and backward using n and p, mark the pictures I like with m and finally go back to Dired with q – and then press C to copy all marked files wherever I want. How cool is that?

CategoryEnglish, CategoryBlog, CategoryEmacs