emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Stinky Wizzleteet <wizzleteet@hotmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: insert picture feature request.
Date: Wed, 25 May 2011 11:00:03 +0200	[thread overview]
Message-ID: <irigek$pc3$1@dough.gmane.org> (raw)
In-Reply-To: <163798.45474.qm@web32007.mail.mud.yahoo.com>

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 Adams<RLAdams@AdamsInfoServ.Com>  wrote:
>
>> From: Russell Adams<RLAdams@AdamsInfoServ.Com>
>> Subject: Re: [O] insert picture feature request.
>> To: "Rainer Stengele"<rainer.stengele@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
>>                  RLAdams@AdamsInfoServ.com
>>
>> PGP Key ID:     0x1160DCB3
>>         http://www.adamsinfoserv.com/
>>
>> Fingerprint:    1723 D8CA 4280 1EC9 557F
>> 66E8 1154 E018 1160 DCB3
>>
>>
>
>

  parent reply	other threads:[~2011-05-25 14:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02 12:42 insert picture feature request Piter_
2011-05-02 13:28 ` Russell Adams
2011-05-02 14:23   ` brian powell
2011-05-02 23:34     ` Piter_
2011-05-04  0:37   ` Mark S.
2011-05-04 10:01     ` Rainer Stengele
2011-05-04 12:38       ` Jambunathan K
2011-05-04 14:10         ` Jambunathan K
2011-05-04 13:19       ` Russell Adams
2011-05-07 21:33         ` Mark S.
2011-05-08  4:29           ` Aankhen
2011-05-08 16:28             ` Mark S.
2011-05-08 18:51               ` Mark S.
2011-05-08 23:11                 ` Nick Dokos
2011-05-09  2:05                   ` Mark S.
2011-05-16  8:32                     ` Aankhen
2011-05-25  9:00           ` Stinky Wizzleteet [this message]
2011-05-04 13:28       ` Rainer Stengele

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='irigek$pc3$1@dough.gmane.org' \
    --to=wizzleteet@hotmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).