From mboxrd@z Thu Jan 1 00:00:00 1970 From: Klaus-Dieter Bauer Subject: Re: Help, I need to paste raw image from clipboard into emacs/orgmode Date: Fri, 7 Jun 2013 20:15:15 +0200 Message-ID: References: <87obbiferr.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b5da81371bc6604de946b72 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50718) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ul1CY-00023J-8k for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 14:15:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ul1CV-0006ec-6Z for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 14:15:50 -0400 Received: from mail-ve0-x22b.google.com ([2607:f8b0:400c:c01::22b]:52103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ul1CU-0006eP-IQ for emacs-orgmode@gnu.org; Fri, 07 Jun 2013 14:15:46 -0400 Received: by mail-ve0-f171.google.com with SMTP id b10so3276577vea.2 for ; Fri, 07 Jun 2013 11:15:46 -0700 (PDT) In-Reply-To: <87obbiferr.fsf@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Vitalie Spinu Cc: org-mode mailing list --047d7b5da81371bc6604de946b72 Content-Type: text/plain; charset=UTF-8 (defun my-org-insert-clipboard () (interactive) (let* ((image-file "clipboard.png") (exit-status (call-process "convert" nil nil nil "clipboard:" image-file))) (org-insert-link nil (concat "file:" image-file) "") (org-display-inline-images))) That works for me (Emacs 24.3, Windows 7) though for practical use some more edge case handling ("don't insert on failure", "different name if file exists") will be wanted. kind regards, Klaus 2013/6/7 Vitalie Spinu > > Thanks for the tip. Do you have an elisp piece that handles the image > insertion into org buffers? > > Thanks, > > Vitalie > > >> Klaus-Dieter Bauer > >> on Thu, 6 Jun 2013 19:16:26 +0200 wrote: > > > Dear All, > > Please Help, > > I need to paste raw image from clipboard into emacs/orgmode, I am a > > microsoft onenote user and I got used to take a lot of snapshots > and embed > > it into my notes, I think if I could know how to embed images > directly into > > emacs/orgmode from clipboard, I will switch to emacs very easily. > > > I searched the internet but unfortunately I didn't find the answer, > > Thanks a lot. > > Dodo > > > Hello! > > > While the original poster probably long since has implemented one of the > > previously suggested solutions (or given up) I thought I'd share a more > general > > solution I found [1]. > > > ImageMagick's `convert' can use clipboard: as input file (don't know if > it works > > as output file). > > > convert clipboard: FILENAME-WITH-EXTENSION > > > I tested it with the cygwin and native windows versions and both worked. > > > king regards, Klaus > > > PS1: On Windows `convert.exe' might be shadowed by another executable, > > especially C:\Windows\System32\convert.exe. In that case the PATH > variable > > should be adjusted such that ImageMagick comes before > C:\Windows\system32. To > > check what shadows the executable, you can run "where convert" in the > > Windows-commandline. > > PS2: On Windows only basic image-displaying-support is included > out-of-the-box. > > To get full support, the easiest way is to install the full GnuWin32 > tools > > (which include the necessary image libraries) with the web-installer. > > > ------ > > > [1] User "magick" in > > > http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=7524&p=22859 > . > > --047d7b5da81371bc6604de946b72 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
(defun my-org-insert-clipboard ()
=C2= =A0 (interactive)
=C2=A0 (let* ((image-file "clipboard.png&q= uot;)
(exit-s= tatus=C2=A0
=C2=A0(call-process &qu= ot;convert" nil nil nil=C2=A0
"clipboard:" image-file)))
=C2= =A0 =C2=A0 (org-insert-link nil (concat "file:" image-file) "= ;")
=C2=A0 =C2=A0 (org-display-inline-images)))

=
That works for me (Emacs 24.3, Windows 7) though for practical u= se some more edge case handling ("don't insert on failure", &= quot;different name if file exists") will be wanted.=C2=A0

kind regards, Klaus


2013/6/7 Vitalie Spinu <= spinuvit@gmail.com>

Thanks for the tip. Do you have an elisp piece that handles the image
insertion into org buffers?

Thanks,

=C2=A0 =C2=A0 Vitalie

=C2=A0>> Klaus-Dieter Bauer <bauer.klaus.dieter@gmail.com>
=C2=A0>> on Thu, 6 Jun 2013 19:16:26 +0200 wrote:

=C2=A0> =C2=A0 =C2=A0 Dear All,
=C2=A0> =C2=A0 =C2=A0 Please Help,
=C2=A0> =C2=A0 =C2=A0 I need to paste raw image from clipboard into emac= s/orgmode, I am a
=C2=A0> =C2=A0 =C2=A0 microsoft onenote user and I got used to take a lo= t of snapshots and embed
=C2=A0> =C2=A0 =C2=A0 it into my notes, I think if I could know how to e= mbed images directly into
=C2=A0> =C2=A0 =C2=A0 emacs/orgmode from clipboard, I will switch to ema= cs very easily.

=C2=A0> =C2=A0 =C2=A0 I searched the internet but unfortunately I didn&#= 39;t find the answer,
=C2=A0> =C2=A0 =C2=A0 Thanks a lot.
=C2=A0> =C2=A0 =C2=A0 Dodo

=C2=A0> Hello!

=C2=A0> While the original poster probably long since has implemented on= e of the
=C2=A0> previously suggested solutions (or given up) I thought I'd s= hare a more general
=C2=A0> solution I found [1].

=C2=A0> ImageMagick's `convert' can use clipboard: as input file= (don't know if it works
=C2=A0> as output file).

=C2=A0> convert clipboard: FILENAME-WITH-EXTENSION

=C2=A0> I tested it with the cygwin and native windows versions and both= worked.

=C2=A0> king regards, Klaus

=C2=A0> PS1: On Windows `convert.exe' might be shadowed by another e= xecutable,
=C2=A0> especially C:\Windows\System32\convert.exe. In that case the PAT= H variable
=C2=A0> should be adjusted such that ImageMagick comes before C:\Windows= \system32. To
=C2=A0> check what shadows the executable, you can run "where conve= rt" in the
=C2=A0> Windows-commandline.
=C2=A0> PS2: On Windows only basic image-displaying-support is included = out-of-the-box.
=C2=A0> To get full support, the easiest way is to install the full GnuW= in32 tools
=C2=A0> (which include the necessary image libraries) with the web-insta= ller.

=C2=A0> ------

=C2=A0> [1] User "magick" in
=C2=A0> http://www.imagema= gick.org/discourse-server/viewtopic.php?f=3D1&t=3D7524&p=3D22859.


--047d7b5da81371bc6604de946b72--