Re: [O] insert picture feature request.

2011-05-25 Thread Stinky Wizzleteet

Hi All,


I've looked into this as well and I found the following:

On X the import function from imagemagick is very versatile. It can 
capoture the entire screen, or a rectangle on the screen selected by the 
user, it is possible to retain that rectangle for subsequent grabs in 
the session by catching the verbose output of the import command.


On windows however, the import command exists in the imagemagick windows 
binaries, but it only grabs X sessions, not an MSwin screen, therefor it 
is useless.
But, among all the screengrabutils for window out there I found 
something that could be of interest here, the Python PIL package allows 
for screengrabs *and* for clipboard dumping:


## start python src
import os
import sys
import time
import Image
import ImageGrab
def ensure_dir(f):
d = os.path.dirname(f)
if not os.path.exists(d):
os.makedirs(d)
#-
#User Settings:
SaveDirectory=r'c:/Screengrabs'
#taking a screenshot is as simple as:
#img=ImageGrab.grab()

im= ImageGrab.grabclipboard()
savename='ScreenShot_'+time.strftime(%y%m%d_%H_%M_%S)+'.png'
saveas=os.path.join(SaveDirectory,savename)
print saveas: %s %saveas
ensure_dir(saveas)
if isinstance(im, Image.Image):
im.save(saveas)
print image saved to %s% (saveas)
else:
print not image in clipboard

## end python src

This could be extended to be multiplatform, as I understand that PIL's 
imagegrab does not work on X11 (at least it does not on my n900)


My 2 cents here..

wzzl.
On 7-5-2011 23:33, Mark S. wrote:

This is very close ... I think. The problem is that the file name needs to be 
formatted for Windows. Currently its formatted  using unix style forward 
slashes. The file name that is passed to irfan in the call process needs to be 
formatted with Windows style backslashes. Without this fix, irfan will complain 
that it doesn't recognize the file type. In other languages I could figure out 
how to do the replace sequence, but it would take me awhile in lisp. Is there a 
quick fix?

Thanks!
Mark

--- On Wed, 5/4/11, Russell Adamsrlad...@adamsinfoserv.com  wrote:


From: Russell Adamsrlad...@adamsinfoserv.com
Subject: Re: [O] insert picture feature request.
To: Rainer Stengelerainer.steng...@diplan.de
Date: Wednesday, May 4, 2011, 6:19 AM
On Wed, May 04, 2011 at 12:01:53PM
+0200, Rainer Stengele wrote:


i_view32.exe /capture=2

/convert=c:\capture_$U(%d%m%Y_%H%M%S).jpg

(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 filename
 (concat
  (make-temp-name
   (concat
(buffer-file-name)

   _

   (format-time-string

%Y%m%d_%H%M%S_)) ) .png))
   (call-process i_view32.exe nil nil nil

/capture=2 (concat /convert= filename) )
   (insert (concat [[ filename ]]))
   (org-display-inline-images))

Does that work? Elisp is formatting the filename based on
the Org
buffer you're in and adding a timestamp.

--
Russell Adams
 rlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3
http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F
66E8 1154 E018 1160 DCB3











Re: [O] insert picture feature request.

2011-05-16 Thread Aankhen
Sorry for the late response!  I forgot about this thread.

On Mon, May 9, 2011 at 07:35, Mark S. throa...@yahoo.com wrote:
 Note to Aankhen: To get inline images to work, you need to install the PNG 
 and JPEG libraries from http://gnuwin32.sourceforge.net/ . Then put the 
 resulting C:...gnuwin32/bin directory in your windows system path. Maybe 
 everyone here already knew this, but I had to spend a bit of time to work it 
 out.

My local copy of Emacs has all the libraries in place.  The problem
seems to be the path: the directory has spaces in it, and the final
call is:

  i_view32.exe /capture=2 /convert=Z:/Foo bar/baz.png

In other words, the entire argument is quoted rather than just the
path.  I fixed this by only passing the file name, as it runs in the
same directory.  Dunno whether there’s a way to disable quoting for
part of an argument.

Aankhen



Re: [O] insert picture feature request.

2011-05-08 Thread Mark S.
Thanks Aankhen.

That seems to have fixed the technical problem. Unfortunately, because of the 
way irfan works, all I was able to get pictures of was the emacs screen! People 
with lots of screen real-estate can have emacs and their target application up 
at the same time, but that doesn't work on my older screen.

So instead, I have the code grab whatever is in the clipboard and use it. Then 
if I want a screen capture, I can use whatever tool is available. Surfulator 
has a really nice free screen capture. Also, with this approach I can 
right-click on images in the browser, click copy image and use those images 
directly. 

As for viewing, the only way I know is to export to HTML. Ctl-c e b is quick. I 
vaguely remember that there is a way to actually view images inline in Emacs, 
but its not portable or something.

Modified code below.

Thanks!
Mark

(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 filename
   (convert-standard-filename
(concat
 (make-temp-name
  (concat (buffer-file-name)
  _
  (format-time-string
   %Y%m%d_%H%M%S_)) ) .png)))
  (call-process C:\\Program Files\\IrfanView\\i_view32.exe nil nil nil
/clippaste (concat /convert= filename) )
  (insert (concat [[ filename ]]))
  (org-display-inline-images))


--- On Sat, 5/7/11, Aankhen wrote:

 Subject: Re: [O] insert picture feature request.
 
 I believe ‘convert-standard-filename’ should do it:
 
 ,
 | (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 filename
 |        (convert-standard-filename
 |         (concat
 |          (make-temp-name
 |           (concat
 (buffer-file-name)
 |               
    _
 |               
    (format-time-string
 |               
     %Y%m%d_%H%M%S_)) ) .png)))
 |  (call-process i_view32.exe nil nil nil
 |               
 /capture=2 (concat /convert= filename) )
 |  (insert (concat [[ filename ]]))
 |  (org-display-inline-images))
 `
 
 Seems to work here, although I’m unable to get the
 resulting image to
 display inline.
 
 Aankhen




Re: [O] insert picture feature request.

2011-05-08 Thread Mark S.
Additional thought. Having all those pngs in the main directory will get messy. 
I would like to put them in a sub-directory like images. But there doesn't 
seem to be an easy way to insert that into (buffer-file-name). I've looked, but 
can't seem to be a variable that just holds the current buffer directory. Where 
would I start?

Thanks!
Mark

--- On Sun, 5/8/11, Mark S. throa...@yahoo.com wrote:

 From: Mark S. throa...@yahoo.com
 Subject: Re: [O] insert picture feature request.
 To: emacs-orgmode@gnu.org
 Date: Sunday, May 8, 2011, 9:28 AM
 Thanks Aankhen.
 
 That seems to have fixed the technical problem.
 Unfortunately, because of the way irfan works, all I was
 able to get pictures of was the emacs screen! People with
 lots of screen real-estate can have emacs and their target
 application up at the same time, but that doesn't work on my
 older screen.
 
 So instead, I have the code grab whatever is in the
 clipboard and use it. Then if I want a screen capture, I can
 use whatever tool is available. Surfulator has a really nice
 free screen capture. Also, with this approach I can
 right-click on images in the browser, click copy image and
 use those images directly. 
 
 As for viewing, the only way I know is to export to HTML.
 Ctl-c e b is quick. I vaguely remember that there is a way
 to actually view images inline in Emacs, but its not
 portable or something.
 
 Modified code below.
 
 Thanks!
 Mark
 
 (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 filename
        (convert-standard-filename
         (concat
          (make-temp-name
           (concat
 (buffer-file-name)
                
   _
                
   (format-time-string
                
    %Y%m%d_%H%M%S_)) ) .png)))
   (call-process C:\\Program
 Files\\IrfanView\\i_view32.exe nil nil nil
                
 /clippaste (concat /convert= filename) )
   (insert (concat [[ filename ]]))
   (org-display-inline-images))
 
 
 --- On Sat, 5/7/11, Aankhen wrote:
 
  Subject: Re: [O] insert picture feature request.
  
  I believe ‘convert-standard-filename’ should do
 it:
  
  ,
  | (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 filename
  |        (convert-standard-filename
  |         (concat
  |          (make-temp-name
  |           (concat
  (buffer-file-name)
  |               
     _
  |               
     (format-time-string
  |               
      %Y%m%d_%H%M%S_)) ) .png)))
  |  (call-process i_view32.exe nil nil nil
  |               
  /capture=2 (concat /convert= filename) )
  |  (insert (concat [[ filename ]]))
  |  (org-display-inline-images))
  `
  
  Seems to work here, although I’m unable to get the
  resulting image to
  display inline.
  
  Aankhen
 
 




Re: [O] insert picture feature request.

2011-05-08 Thread Nick Dokos
Mark S. throa...@yahoo.com wrote:

 Additional thought. Having all those pngs in the main directory will
 get messy. I would like to put them in a sub-directory like
 images. But there doesn't seem to be an easy way to insert that into
 (buffer-file-name). I've looked, but can't seem to be a variable that
 just holds the current buffer directory. Where would I start?
 

C-h f file-name-directory RET
C-h f file-name-nondirectory RET

Nick



Re: [O] insert picture feature request.

2011-05-08 Thread Mark S.
Thanks Nick!

Revised code below with your help. Note that I've changed the name of function 
to reflect the fact that we're using the clipboard for the shot. Also, needed 
file: in the insert name for the inline images to view directly.

Note to Aankhen: To get inline images to work, you need to install the PNG and 
JPEG libraries from http://gnuwin32.sourceforge.net/ . Then put the resulting 
C:...gnuwin32/bin directory in your windows system path. Maybe everyone here 
already knew this, but I had to spend a bit of time to work it out.

Thanks!
Mark


(defun org-clipshot ()
  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 filename
   (convert-standard-filename
(concat
 (make-temp-name
  (concat 
;;  (buffer-file-name)
 (file-name-directory (buffer-file-name))
  images/
 (file-name-nondirectory (buffer-file-name))
  _
  (format-time-string
   %Y%m%d_%H%M%S_)) ) .png)))
  (call-process C:\\Program Files\\IrfanView\\i_view32.exe nil nil nil
/clippaste (concat /convert= filename) )
  (insert (concat [[file: filename ]]))
  (org-display-inline-images))




--- On Sun, 5/8/11, Nick Dokos nicholas.do...@hp.com wrote:

 From: Nick Dokos nicholas.do...@hp.com
 Subject: Re: [O] insert picture feature request.
 To: Mark S. throa...@yahoo.com
 Cc: nicholas.do...@hp.com, emacs-orgmode@gnu.org
 Date: Sunday, May 8, 2011, 4:11 PM
 Mark S. throa...@yahoo.com
 wrote:
 
  Additional thought. Having all those pngs in the main
 directory will
  get messy. I would like to put them in a sub-directory
 like
  images. But there doesn't seem to be an easy way to
 insert that into
  (buffer-file-name). I've looked, but can't seem to be
 a variable that
  just holds the current buffer directory. Where would I
 start?
  
 
 C-h f file-name-directory RET
 C-h f file-name-nondirectory RET
 
 Nick
 
 



Re: [O] insert picture feature request.

2011-05-04 Thread Rainer Stengele
+1 for windows support.

I would also need such a image copy tool under windows.

A way to capture an image and have it referenced/included in an org file
with a simple keychord would be most welcome.

What most of my colleagues - non Emacs users - do is open MS Word,
paste some captured images and write some simple comments.
No need to copy, save and link to an image.
A documentation including some screenshots is done in a snap.

For me this is one of the things I miss a lot while living in Org.
Anybody knows about a comparable tool to Imagemagick import under Windows?

===

OK - I searched a bit and found this, which works on command line: (see 
http://www.irfanview.de)


Example for /capture:
i_view32.exe /capture=0
Capture the whole screen.
i_view32.exe /capture=6
Start in Capture mode, use last used capture dialog settings.

capture values:
0 = whole screen
1 = current monitor, where mouse is located
2 = foreground window
3 = foreground window - client area
4 = rectangle selection
5 = object selected with the mouse
6 = start in capture mode (can't be combined with other commandline options)

Advanced examples:
i_view32.exe /capture=2 /convert=c:\test.jpg
Capture foreground window and save result as file.
i_view32.exe /capture=2 /convert=c:\capture_$U(%d%m%Y_%H%M%S).jpg
Capture foreground window and save result as file; the file name contains time 
stamp.
===

I will try this in my Org environment.

-- Rainer



Am 04.05.2011 02:37, schrieb Mark S.:
 This doesn't work under windows even if you have ImageMagick installed. Is 
 there a similar way to capture and insert a picture under windows?
 
 Thanks!
 
 --- On Mon, 5/2/11, Russell Adams rlad...@adamsinfoserv.com wrote:
 
 From: Russell Adams rlad...@adamsinfoserv.com
 Subject: Re: [O] insert picture feature request.
 To: emacs-orgmode@gnu.org
 Date: Monday, May 2, 2011, 6:28 AM
 On Mon, May 02, 2011 at 02:42:41PM
 +0200, Piter_ wrote:
 Hi all.
 I use org-mode for making note while reading
 articles.
 Sometimes I want to insert picture into notes. Now it
 takes to much
 time. I have to copy paste it into picture editor,
 save it and than
 make a link to it.
 I would like to do it in other way. Copy picture into
 clipboard (from
 pdf reader for example), and than run a function in
 emacs which will
 ask for file name, save the picture from clipboard
 into preset folder
 and insert link into org file for it.
 I have found those links.
 http://stackoverflow.com/questions/1868734/how-to-copy-to-clipboard-with-x11
 http://stackoverflow.com/questions/3571179/how-does-x11-clipboard-handle-multiple-data-formats

 About handling clipboard images from python.
 I think it is possible to write a simple python script
 which can save
 clipboard picture into file, and than some lisp
 function which do all
 I described above using this script.
 Unfortunately I dont know  python and lisp on
 level which allow me to
 do it fast end easy. So I ask if someone can do it. I
 think it would
 be useful addition for org-mode. May be even someone
 have implemented
 it, or made another work arround  this problem.
 Thanks.
 Petro.
 P.S. Sorry if you get two copies of request. I had
 some troubles with
 sending it and may sent two versions of this mail.


 There was a discussion with a working solution not long ago
 for taking
 screenshots and inserting them into org automatically.

 http://comments.gmane.org/gmane.emacs.orgmode/33770

 I suspect the code is on worg.

 Enjoy.

 --
 Russell Adams   
 rlad...@adamsinfoserv.com

 PGP Key ID: 0x1160DCB3   
http://www.adamsinfoserv.com/

 Fingerprint:1723 D8CA 4280 1EC9 557F 
 66E8 1154 E018 1160 DCB3


 
 





Re: [O] insert picture feature request.

2011-05-04 Thread Russell Adams
On Wed, May 04, 2011 at 12:01:53PM +0200, Rainer Stengele wrote:

 i_view32.exe /capture=2 /convert=c:\capture_$U(%d%m%Y_%H%M%S).jpg

(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 filename
(concat
 (make-temp-name
  (concat (buffer-file-name)
  _
  (format-time-string
   %Y%m%d_%H%M%S_)) ) .png))
  (call-process i_view32.exe nil nil nil
/capture=2 (concat /convert= filename) )
  (insert (concat [[ filename ]]))
  (org-display-inline-images))

Does that work? Elisp is formatting the filename based on the Org
buffer you're in and adding a timestamp.

--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



Re: [O] insert picture feature request.

2011-05-04 Thread Rainer Stengele
Am 04.05.2011 12:01, schrieb Rainer Stengele:
 +1 for windows support.
 
 I would also need such a image copy tool under windows.
 
 A way to capture an image and have it referenced/included in an org file
 with a simple keychord would be most welcome.
 
 What most of my colleagues - non Emacs users - do is open MS Word,
 paste some captured images and write some simple comments.
 No need to copy, save and link to an image.
 A documentation including some screenshots is done in a snap.
 
 For me this is one of the things I miss a lot while living in Org.
 Anybody knows about a comparable tool to Imagemagick import under Windows?
 
 ===
 
 OK - I searched a bit and found this, which works on command line: (see 
 http://www.irfanview.de)
 
 
 Example for /capture:
 i_view32.exe /capture=0
 Capture the whole screen.
 i_view32.exe /capture=6
 Start in Capture mode, use last used capture dialog settings.
 
 capture values:
 0 = whole screen
 1 = current monitor, where mouse is located
 2 = foreground window
 3 = foreground window - client area
 4 = rectangle selection
 5 = object selected with the mouse
 6 = start in capture mode (can't be combined with other commandline options)
 
 Advanced examples:
 i_view32.exe /capture=2 /convert=c:\test.jpg
 Capture foreground window and save result as file.
 i_view32.exe /capture=2 /convert=c:\capture_$U(%d%m%Y_%H%M%S).jpg
 Capture foreground window and save result as file; the file name contains 
 time stamp.
 ===
 
 I will try this in my Org environment.
 
 -- Rainer
 
 
 
 Am 04.05.2011 02:37, schrieb Mark S.:
 This doesn't work under windows even if you have ImageMagick installed. Is 
 there a similar way to capture and insert a picture under windows?

 Thanks!

 --- On Mon, 5/2/11, Russell Adams rlad...@adamsinfoserv.com wrote:

 From: Russell Adams rlad...@adamsinfoserv.com
 Subject: Re: [O] insert picture feature request.
 To: emacs-orgmode@gnu.org
 Date: Monday, May 2, 2011, 6:28 AM
 On Mon, May 02, 2011 at 02:42:41PM
 +0200, Piter_ wrote:
 Hi all.
 I use org-mode for making note while reading
 articles.
 Sometimes I want to insert picture into notes. Now it
 takes to much
 time. I have to copy paste it into picture editor,
 save it and than
 make a link to it.
 I would like to do it in other way. Copy picture into
 clipboard (from
 pdf reader for example), and than run a function in
 emacs which will
 ask for file name, save the picture from clipboard
 into preset folder
 and insert link into org file for it.
 I have found those links.
 http://stackoverflow.com/questions/1868734/how-to-copy-to-clipboard-with-x11
 http://stackoverflow.com/questions/3571179/how-does-x11-clipboard-handle-multiple-data-formats

 About handling clipboard images from python.
 I think it is possible to write a simple python script
 which can save
 clipboard picture into file, and than some lisp
 function which do all
 I described above using this script.
 Unfortunately I dont know  python and lisp on
 level which allow me to
 do it fast end easy. So I ask if someone can do it. I
 think it would
 be useful addition for org-mode. May be even someone
 have implemented
 it, or made another work arround  this problem.
 Thanks.
 Petro.
 P.S. Sorry if you get two copies of request. I had
 some troubles with
 sending it and may sent two versions of this mail.


 There was a discussion with a working solution not long ago
 for taking
 screenshots and inserting them into org automatically.

 http://comments.gmane.org/gmane.emacs.orgmode/33770

 I suspect the code is on worg.

 Enjoy.

 --
 Russell Adams   
 rlad...@adamsinfoserv.com

 PGP Key ID: 0x1160DCB3   
http://www.adamsinfoserv.com/

 Fingerprint:1723 D8CA 4280 1EC9 557F 
 66E8 1154 E018 1160 DCB3




 
 
 
 
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

Re: [O] insert picture feature request.

2011-05-04 Thread Jambunathan K
Jambunathan K kjambunat...@gmail.com writes:

 +1 for windows support.

 I would also need such a image copy tool under windows.


 A way to capture an image and have it referenced/included in an org file
 with a simple keychord would be most welcome.

 For me this is one of the things I miss a lot while living in Org.
 Anybody knows about a comparable tool to Imagemagick import under
 Windows?

 Here comes Emacswiki to the rescue!

 http://rasm.ods.org/boxcutter/download/boxcutter-1.3/
 http://www.emacswiki.org/emacs/mon-boxcutter.el


From the el above file:

--8---cut here---start-8---
;; boxcutter.exe is one of the few (perhaps only) screenshot utility
;; that can be called from the command line AND has a compatible license
;; LGPL. This is important, esp. on w32. Many w32 graphics apps lack
;; FOSS licensing...
--8---cut here---end---8---


 Disclaimer: I haven't tried it. This is purely for my link karma.

 Jambunathan K.

-- 



Re: [O] insert picture feature request.

2011-05-03 Thread Mark S.
This doesn't work under windows even if you have ImageMagick installed. Is 
there a similar way to capture and insert a picture under windows?

Thanks!

--- On Mon, 5/2/11, Russell Adams rlad...@adamsinfoserv.com wrote:

 From: Russell Adams rlad...@adamsinfoserv.com
 Subject: Re: [O] insert picture feature request.
 To: emacs-orgmode@gnu.org
 Date: Monday, May 2, 2011, 6:28 AM
 On Mon, May 02, 2011 at 02:42:41PM
 +0200, Piter_ wrote:
  Hi all.
  I use org-mode for making note while reading
 articles.
  Sometimes I want to insert picture into notes. Now it
 takes to much
  time. I have to copy paste it into picture editor,
 save it and than
  make a link to it.
  I would like to do it in other way. Copy picture into
 clipboard (from
  pdf reader for example), and than run a function in
 emacs which will
  ask for file name, save the picture from clipboard
 into preset folder
  and insert link into org file for it.
  I have found those links.
  http://stackoverflow.com/questions/1868734/how-to-copy-to-clipboard-with-x11
  http://stackoverflow.com/questions/3571179/how-does-x11-clipboard-handle-multiple-data-formats
 
  About handling clipboard images from python.
  I think it is possible to write a simple python script
 which can save
  clipboard picture into file, and than some lisp
 function which do all
  I described above using this script.
  Unfortunately I dont know  python and lisp on
 level which allow me to
  do it fast end easy. So I ask if someone can do it. I
 think it would
  be useful addition for org-mode. May be even someone
 have implemented
  it, or made another work arround  this problem.
  Thanks.
  Petro.
  P.S. Sorry if you get two copies of request. I had
 some troubles with
  sending it and may sent two versions of this mail.
 
 
 There was a discussion with a working solution not long ago
 for taking
 screenshots and inserting them into org automatically.
 
 http://comments.gmane.org/gmane.emacs.orgmode/33770
 
 I suspect the code is on worg.
 
 Enjoy.
 
 --
 Russell Adams           
                 rlad...@adamsinfoserv.com
 
 PGP Key ID:     0x1160DCB3   
        http://www.adamsinfoserv.com/
 
 Fingerprint:    1723 D8CA 4280 1EC9 557F 
 66E8 1154 E018 1160 DCB3
 




[O] insert picture feature request.

2011-05-02 Thread Piter_
Hi all.
I use org-mode for making note while reading articles.
Sometimes I want to insert picture into notes. Now it takes to much
time. I have to copy paste it into picture editor, save it and than
make a link to it.
I would like to do it in other way. Copy picture into clipboard (from
pdf reader for example), and than run a function in emacs which will
ask for file name, save the picture from clipboard into preset folder
and insert link into org file for it.
I have found those links.
http://stackoverflow.com/questions/1868734/how-to-copy-to-clipboard-with-x11
http://stackoverflow.com/questions/3571179/how-does-x11-clipboard-handle-multiple-data-formats

About handling clipboard images from python.
I think it is possible to write a simple python script which can save
clipboard picture into file, and than some lisp function which do all
I described above using this script.
Unfortunately I dont know  python and lisp on level which allow me to
do it fast end easy. So I ask if someone can do it. I think it would
be useful addition for org-mode. May be even someone have implemented
it, or made another work arround  this problem.
Thanks.
Petro.
P.S. Sorry if you get two copies of request. I had some troubles with
sending it and may sent two versions of this mail.



Re: [O] insert picture feature request.

2011-05-02 Thread Russell Adams
On Mon, May 02, 2011 at 02:42:41PM +0200, Piter_ wrote:
 Hi all.
 I use org-mode for making note while reading articles.
 Sometimes I want to insert picture into notes. Now it takes to much
 time. I have to copy paste it into picture editor, save it and than
 make a link to it.
 I would like to do it in other way. Copy picture into clipboard (from
 pdf reader for example), and than run a function in emacs which will
 ask for file name, save the picture from clipboard into preset folder
 and insert link into org file for it.
 I have found those links.
 http://stackoverflow.com/questions/1868734/how-to-copy-to-clipboard-with-x11
 http://stackoverflow.com/questions/3571179/how-does-x11-clipboard-handle-multiple-data-formats

 About handling clipboard images from python.
 I think it is possible to write a simple python script which can save
 clipboard picture into file, and than some lisp function which do all
 I described above using this script.
 Unfortunately I dont know  python and lisp on level which allow me to
 do it fast end easy. So I ask if someone can do it. I think it would
 be useful addition for org-mode. May be even someone have implemented
 it, or made another work arround  this problem.
 Thanks.
 Petro.
 P.S. Sorry if you get two copies of request. I had some troubles with
 sending it and may sent two versions of this mail.


There was a discussion with a working solution not long ago for taking
screenshots and inserting them into org automatically.

http://comments.gmane.org/gmane.emacs.orgmode/33770

I suspect the code is on worg.

Enjoy.

--
Russell Adamsrlad...@adamsinfoserv.com

PGP Key ID: 0x1160DCB3   http://www.adamsinfoserv.com/

Fingerprint:1723 D8CA 4280 1EC9 557F  66E8 1154 E018 1160 DCB3



Re: [O] insert picture feature request.

2011-05-02 Thread brian powell
* This is what I use (thanks to whomever wrote the original):

(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 filename
 (concat
  (make-temp-name
   (concat (buffer-file-name)
   _
   (format-time-string
%Y%m%d_%H%M%S_)) ) .png))
   (call-process import nil nil nil filename)
   (insert (concat [[ filename ]])))

** Works great for me, puts a timestamp on it and the filename.

** Also, notice the .png:

*** The link above suggests .jpg (as the default)--which is great
for most things; except, JPG is a lossy compression format, but it
does load faster.

 http://www.turnkeylinux.org/blog/png-vs-jpg



Re: [O] insert picture feature request.

2011-05-02 Thread Piter_
Thanks.
It is what I need.

Than

On Mon, May 2, 2011 at 4:23 PM, brian powell briangpowel...@gmail.com wrote:
 * This is what I use (thanks to whomever wrote the original):

 (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 filename
                                 (concat
                                  (make-temp-name
                                   (concat (buffer-file-name)
                                           _
                                           (format-time-string
 %Y%m%d_%H%M%S_)) ) .png))
                           (call-process import nil nil nil filename)
                           (insert (concat [[ filename ]])))

 ** Works great for me, puts a timestamp on it and the filename.

 ** Also, notice the .png:

 *** The link above suggests .jpg (as the default)--which is great
 for most things; except, JPG is a lossy compression format, but it
 does load faster.

  http://www.turnkeylinux.org/blog/png-vs-jpg