* Help, I need to paste raw image from clipboard into emacs/orgmode
@ 2011-07-20 14:59 Medhat Essmat
2011-07-24 18:26 ` suvayu ali
2011-07-24 20:11 ` Rainer Stengele
0 siblings, 2 replies; 7+ messages in thread
From: Medhat Essmat @ 2011-07-20 14:59 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 400 bytes --]
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
[-- Attachment #2: Type: text/html, Size: 671 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help, I need to paste raw image from clipboard into emacs/orgmode
2011-07-20 14:59 Medhat Essmat
@ 2011-07-24 18:26 ` suvayu ali
2011-07-24 20:11 ` Rainer Stengele
1 sibling, 0 replies; 7+ messages in thread
From: suvayu ali @ 2011-07-24 18:26 UTC (permalink / raw)
To: Medhat Essmat; +Cc: emacs-orgmode
On Wed, Jul 20, 2011 at 4:59 PM, Medhat Essmat <e.medhat@ieee.org> wrote:
> 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.
You can see this[1] section on Worg dealing with this issue. However
this solution uses the ImageMagick library. I am not sure this is
available on Windows. Maybe you can adapt this and find a solution that
fits your need.
Footnotes:
[1] http://orgmode.org/worg/org-hacks.html#sec-3-8
--
Suvayu
Open source is the future. It sets us free.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help, I need to paste raw image from clipboard into emacs/orgmode
2011-07-20 14:59 Medhat Essmat
2011-07-24 18:26 ` suvayu ali
@ 2011-07-24 20:11 ` Rainer Stengele
1 sibling, 0 replies; 7+ messages in thread
From: Rainer Stengele @ 2011-07-24 20:11 UTC (permalink / raw)
To: Medhat Essmat; +Cc: emacs-orgmode
Am 20.07.2011 16:59, schrieb Medhat Essmat:
> 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
Dear Dodo,
check this for Windows:
---------------------------------------------------------------------------------------------------------------
The better approach seems to be to take the screenshot image from the clipboard.
Therefore any screenshot tool will do.
This works for me under Windows XP:
(I had to introduce the tilde-buffer-filename variable for irfanview to work)
(defun org-screenshot ()
"Take a screenshot into a time stamped unique-named file in the same directory as the org-buffer and insert
a link to this file."
(interactive)
(setq tilde-buffer-filename
(replace-regexp-in-string "/" "\\" (buffer-file-name) t t))
(setq filename
(concat
(make-temp-name
(concat tilde-buffer-filename
"_"
(format-time-string "%Y%m%d_%H%M%S_")) ) ".jpg"))
;; Linux: ImageMagick: (call-process "import" nil nil nil filename)
;; Windows: Irfanview
(call-process "c:\\Programme\\IrfanView\\i_view32.exe" nil nil nil (concat "/clippaste /convert=" filename))
(insert (concat "[[file:" filename "]]"))
(org-display-inline-images))
So this is how it works:
1. take a screenshot with any tool you are used to use
2. change to your org buffer and call "org-screenshot" via M-x
Instead of ".jpg" you can use any format IrfanView understands, for example "png".
Very useful!
-- Rainer
---------------------------------------------------------------------------------------------------------------
Check the corrsponding gmane thread with subject "insert picture feature request."
-- Rainer
^ permalink raw reply [flat|nested] 7+ messages in thread
* Help, I need to paste raw image from clipboard into emacs/orgmode
@ 2013-06-06 17:16 Klaus-Dieter Bauer
2013-06-07 9:31 ` Vitalie Spinu
0 siblings, 1 reply; 7+ messages in thread
From: Klaus-Dieter Bauer @ 2013-06-06 17:16 UTC (permalink / raw)
To: e.medhat; +Cc: org-mode mailing list
[-- Attachment #1: Type: text/plain, Size: 1495 bytes --]
>
> 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
.
[-- Attachment #2: Type: text/html, Size: 2162 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help, I need to paste raw image from clipboard into emacs/orgmode
2013-06-06 17:16 Help, I need to paste raw image from clipboard into emacs/orgmode Klaus-Dieter Bauer
@ 2013-06-07 9:31 ` Vitalie Spinu
2013-06-07 18:15 ` Klaus-Dieter Bauer
0 siblings, 1 reply; 7+ messages in thread
From: Vitalie Spinu @ 2013-06-07 9:31 UTC (permalink / raw)
To: Klaus-Dieter Bauer; +Cc: org-mode mailing list, e.medhat
Thanks for the tip. Do you have an elisp piece that handles the image
insertion into org buffers?
Thanks,
Vitalie
>> Klaus-Dieter Bauer <bauer.klaus.dieter@gmail.com>
>> 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.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help, I need to paste raw image from clipboard into emacs/orgmode
2013-06-07 9:31 ` Vitalie Spinu
@ 2013-06-07 18:15 ` Klaus-Dieter Bauer
2013-11-06 15:28 ` Alexander Vorobiev
0 siblings, 1 reply; 7+ messages in thread
From: Klaus-Dieter Bauer @ 2013-06-07 18:15 UTC (permalink / raw)
To: Vitalie Spinu; +Cc: org-mode mailing list
[-- Attachment #1: Type: text/plain, Size: 2422 bytes --]
(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 <spinuvit@gmail.com>
>
> Thanks for the tip. Do you have an elisp piece that handles the image
> insertion into org buffers?
>
> Thanks,
>
> Vitalie
>
> >> Klaus-Dieter Bauer <bauer.klaus.dieter@gmail.com>
> >> 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
> .
>
>
[-- Attachment #2: Type: text/html, Size: 3713 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Help, I need to paste raw image from clipboard into emacs/orgmode
2013-06-07 18:15 ` Klaus-Dieter Bauer
@ 2013-11-06 15:28 ` Alexander Vorobiev
0 siblings, 0 replies; 7+ messages in thread
From: Alexander Vorobiev @ 2013-11-06 15:28 UTC (permalink / raw)
To: Klaus-Dieter Bauer; +Cc: Vitalie Spinu, org-mode mailing list
[-- Attachment #1: Type: text/plain, Size: 4039 bytes --]
Hi Klaus,
I found the function very useful so I expanded it a little to have more
flexible image file names. First, I use the base name of the file in the
current buffer as a prefix to the image file name. Then I added an integer
buffer-local variable to be the image file name's suffix (preceded by an
underscore) which is incremented every time new image is pasted:
#+begin_src emacs-lisp
(defvar org-clipboard-image-suffix 0)
(make-variable-buffer-local 'org-clipboard-image-suffix)
(setq-default org-clipboard-image-suffix 0)
(defun org-insert-clipboard-image ()
(interactive)
(incf org-clipboard-image-suffix)
(let* ((image-file
(concat (file-name-base (buffer-file-name))
"_"
(format "%d" org-clipboard-image-suffix)
".png"))
(exit-status
(call-process "convert" nil nil nil
"clipboard:" image-file)))
(org-insert-link nil (concat "file:" image-file) "")))
#+end_src
It would be very convenient if there were a way to determine if the
clipboard contains an image, then use defadvice to call this function with,
say, org-yank. Unfortunately I couldn't find any emacs functions to query
properties of the content of the (Windows) clipboard. I only see
w32-get-clipboard-data which returns only text.
Regards,
Alex
On Fri, Jun 7, 2013 at 1:15 PM, Klaus-Dieter Bauer <
bauer.klaus.dieter@gmail.com> wrote:
> (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 <spinuvit@gmail.com>
>
>>
>> Thanks for the tip. Do you have an elisp piece that handles the image
>> insertion into org buffers?
>>
>> Thanks,
>>
>> Vitalie
>>
>> >> Klaus-Dieter Bauer <bauer.klaus.dieter@gmail.com>
>> >> 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
>> .
>>
>>
>
[-- Attachment #2: Type: text/html, Size: 5922 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-11-06 15:28 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-06 17:16 Help, I need to paste raw image from clipboard into emacs/orgmode Klaus-Dieter Bauer
2013-06-07 9:31 ` Vitalie Spinu
2013-06-07 18:15 ` Klaus-Dieter Bauer
2013-11-06 15:28 ` Alexander Vorobiev
-- strict thread matches above, loose matches on Subject: below --
2011-07-20 14:59 Medhat Essmat
2011-07-24 18:26 ` suvayu ali
2011-07-24 20:11 ` Rainer Stengele
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).