From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Publishing images to various sizes Date: Sat, 26 Dec 2015 20:31:51 -0500 Message-ID: References: <87fuyr1tkl.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:53056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aD0Bh-0006Lw-54 for emacs-orgmode@gnu.org; Sat, 26 Dec 2015 20:31:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aD0Bd-0004Y2-Vq for emacs-orgmode@gnu.org; Sat, 26 Dec 2015 20:31:57 -0500 Received: from mail-qg0-x234.google.com ([2607:f8b0:400d:c04::234]:35154) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aD0Bd-0004Xq-QT for emacs-orgmode@gnu.org; Sat, 26 Dec 2015 20:31:53 -0500 Received: by mail-qg0-x234.google.com with SMTP id o11so128335133qge.2 for ; Sat, 26 Dec 2015 17:31:53 -0800 (PST) In-reply-to: <87fuyr1tkl.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: Arun Isaac Cc: Emacs orgmode This isn't quite what you want but it is close. It is some code I hacked a while ago to convert pdf files to png files for html export. You can probably adapt this to get the sizes that you want by modifying the shell command. (defun my-link-format (link contents info) (let ((type (org-element-property :type link)) (path (org-element-property :path link))) (cond ((and (string= type "file") (string-match "\.pdf" path)) (shell-command (format "convert %s %s" path (replace-regexp-in-string "\.pdf" ".png" path))) (format "" (replace-regexp-in-string "\.pdf" ".png" path))) ;; anything else, we just do the regular thing (t (org-html-link link contents info))))) (org-export-define-derived-backend 'my-html 'html :translate-alist '((link . my-link-format))) (browse-url (org-export-to-file 'my-html "custom-link.html")) Arun Isaac writes: > Hi, > > Is there some package that provides a publishing function I can use to > automatically publish images to various sizes? Probably something that > wraps around imagemagick's 'convert' command? > > When I publish images to my website, I want them to be available in > various sizes, so that I can choose the appropriate image for the > context in which it appears, and thus optimize bandwidth usage. > > Thanks, > Arun Isaac. -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu