all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to display an image contained in a file?
@ 2016-03-01 18:38 Marcin Borkowski
  2016-03-01 19:04 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Marcin Borkowski @ 2016-03-01 18:38 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi all,

I have an image in the file, say "~/image.png".  I want to display it in
an interactive function - say, the user says M-x display-my-image, and
I want a buffer containing the image to pop up.  What do I do?  Of
course, (find-file "~/image.png") works, but it's probably not what
I should do in an Elisp program, right?

TIA,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to display an image contained in a file?
  2016-03-01 18:38 How to display an image contained in a file? Marcin Borkowski
@ 2016-03-01 19:04 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2016-03-01 19:04 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Marcin Borkowski <mbork@mbork.pl>
> Date: Tue, 01 Mar 2016 19:38:44 +0100
> 
> I have an image in the file, say "~/image.png".  I want to display it in
> an interactive function - say, the user says M-x display-my-image, and
> I want a buffer containing the image to pop up.  What do I do?  Of
> course, (find-file "~/image.png") works, but it's probably not what
> I should do in an Elisp program, right?

 (let ((image (create-image "~/image.png")))
   (pop-to-buffer "*image*")
   (insert-image image))



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-03-01 19:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-01 18:38 How to display an image contained in a file? Marcin Borkowski
2016-03-01 19:04 ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.