From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stinky Wizzleteet Subject: Re: insert picture feature request. Date: Wed, 25 May 2011 11:00:03 +0200 Message-ID: References: <20110504131917.GD2970@x201> <163798.45474.qm@web32007.mail.mud.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([140.186.70.92]:52943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPFJF-0007OQ-NJ for emacs-orgmode@gnu.org; Wed, 25 May 2011 10:43:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QPFJE-00069T-5C for emacs-orgmode@gnu.org; Wed, 25 May 2011 10:43:41 -0400 Received: from lo.gmane.org ([80.91.229.12]:39082) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QPFJD-00068w-RN for emacs-orgmode@gnu.org; Wed, 25 May 2011 10:43:40 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QP9wx-0003SY-4P for emacs-orgmode@gnu.org; Wed, 25 May 2011 11:00:19 +0200 Received: from 195-240-16-67.ip.telfort.nl ([195.240.16.67]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 May 2011 11:00:19 +0200 Received: from wizzleteet by 195-240-16-67.ip.telfort.nl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 25 May 2011 11:00:19 +0200 In-Reply-To: <163798.45474.qm@web32007.mail.mud.yahoo.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: emacs-orgmode@gnu.org 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 wrote: > >> From: Russell Adams >> Subject: Re: [O] insert picture feature request. >> To: "Rainer Stengele" >> 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 >> >> > >