This site uses cookies to deliver our services and to show you relevant ads and job listings.
By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service.
Your use of Stack Overflow’s Products and Services, including the Stack Overflow Network, is subject to these policies and terms.

Join us in building a kind, collaborative learning community via our updated
Code of Conduct.

As I'm using the Emacs Org mode as a research log, sometime I want to keep track of something via screenshot images, and I definitely don't want to save them. So I'm wondering is there any way to insert those figures into my org mode file, like with word coping them from clipboard?

Thanks, that works great. Except I'm still struggling with get 'org-display-inline-images' worked in Aquamacs on Mac. Also I'm wondering since this method is said to be only working on Unix based systems, is there any neat alternative on Windows that you may be aware of?
– linaJul 6 '13 at 1:01

@lina This snippet works for me under cygwin with ImageMagick. ImageMagick has also a windows binary release, but I confess I haven't tried it. You can substitute import in the call to call-process for any snapshot utility that can specify the output filename.
– assemJul 6 '13 at 1:42

@assem I see the benefit of having images embedded in the document as lina points when your research notes have a lot of churn. If you delete the note containing the file, the image will remain in your file system. Do you think there is any way to modify the script for pasting (raw PNG for instance) and being emacs the one showing the image?
– tonicebrianAug 13 '13 at 15:45

@ancechu Buffers with lots of image data would have a performance hit on your standard editing features - even if it's just to skip over image data regions. It would probably be easier to create a hook that asks you if you wish to delete the image file on disk when you delete a note.
– assemAug 18 '13 at 7:29

I'm getting an error, " Searching for program: no such file or directory, import" when trying to run the call-proccess 'import'. It works on my work machine but not at home. Any ideas?
– Leo UfimtsevJan 29 '15 at 4:53

Update: Improvements

I have recently improved on the script a little. It now places screenshots in a subdirectory, creates the directory if required, and only inserts the link into emacs if the image was actually created (i.e., does nothing if you hit ESC). It also works on both Ubuntu and OS X.

(If of use), I used @assem's code (thank you v.much btw) and created a version that instead creates a sub-folder (if it doesn't exist) like : ${filename}IMG/
Then puts an image like img_date.png into that folder
and then inserts a relative path into the buffer like:[[ ./${filename}IMG/img_2015...png ]]

[Edit 2015.04.09]

In the mean time, I found the above doesn't work well. Technically it works, but it generates a lot of folder names that match the file names, making it tedious to select files as there are folder that have a similar name.

Instead I settled with a solution where I keep all my org files in the same folder, and have an 'img' sub folder' with all my images.

This function will work out a file path, then invoke the C# app to create png file, then it will add the image tag and then call org-display-inline-images to show the image. If there is no image on the clipboard, it will paste in the response from the C# app.

I like the images and other material that belongs together with an org file to be located in a clearly associated directory. I am using the org-attachment mechanism for this and wrote a few years back a package org-attachment-screenshot that is also available from MELPA. It allows providing a function for defining the directory name (e.g. document name + some postfix) for the attachments, and will also support the standard attachment functionalities, e.g. if you want to define attachments based on entries, and inheriting within entries.
Also provides customizable variable for the snapshot command to be executed.
Please have a look.

The answers here focus on initiating the process within emacs. An alternative, on macos, is to place a screenshot image on the system clipboard using cmd-ctl-shift-4, and then to return to Emacs and use emacs lisp to call pngpaste to write the image from clipboard to file, and do whatever you need to with the image file (insert into org, LaTeX, or as a native Emacs inline image etc).