* Publishing images to various sizes
@ 2015-12-24 20:26 Arun Isaac
2015-12-27 1:31 ` John Kitchin
0 siblings, 1 reply; 3+ messages in thread
From: Arun Isaac @ 2015-12-24 20:26 UTC (permalink / raw)
To: Emacs orgmode
[-- Attachment #1: Type: text/plain, Size: 414 bytes --]
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Publishing images to various sizes
2015-12-24 20:26 Publishing images to various sizes Arun Isaac
@ 2015-12-27 1:31 ` John Kitchin
2015-12-27 4:00 ` Arun Isaac
0 siblings, 1 reply; 3+ messages in thread
From: John Kitchin @ 2015-12-27 1:31 UTC (permalink / raw)
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 "<img src=\"%s\">" (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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Publishing images to various sizes
2015-12-27 1:31 ` John Kitchin
@ 2015-12-27 4:00 ` Arun Isaac
0 siblings, 0 replies; 3+ messages in thread
From: Arun Isaac @ 2015-12-27 4:00 UTC (permalink / raw)
To: Emacs orgmode
John Kitchin <jkitchin@andrew.cmu.edu> writes:
> (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 "<img src=\"%s\">" (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"))
Thank you. I'll adapt this to my needs.
Regards,
Arun Isaac
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-27 4:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-24 20:26 Publishing images to various sizes Arun Isaac
2015-12-27 1:31 ` John Kitchin
2015-12-27 4:00 ` Arun Isaac
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).