all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: joakim@verona.se
To: emacs-devel@gnu.org
Subject: Re: Slow image display over network
Date: Fri, 24 Sep 2010 15:41:51 +0200	[thread overview]
Message-ID: <m3pqw3tg0w.fsf@verona.se> (raw)
In-Reply-To: <m3ocbnqozy.fsf@quimbies.gnus.org> (Lars Magne Ingebrigtsen's message of "Fri, 24 Sep 2010 14:56:17 +0200")

Lars Magne Ingebrigtsen <larsi@gnus.org> writes:

> joakim@verona.se writes:
>
>> If you look at the imagemagick loader, there is an attempt there at
>> image "pinging", figuring out stuff about images withouth actualy
>> loading them. The pinging there is done to avoid loading an entire image
>> stack when you only want one image index in the stack. Maybe this ping
>> code could be generalized and exposed to lisp. I've noticed the need
>> myself several times.
>
> Yes, that sounds very useful.  If you have the time, could you make this
> info available to the Lisp layer, and I can do some testing?

Meanwhile(I'm out of Emacs hack budget for a while), heres some other
code I had lying around:

(defun emsane-image-size (image-file)
  "Return the size of IMAGE-FILE as a cons."
  ;;TODO I snipped this from "dragbox.el" so it might be reusable
  (with-current-buffer (get-buffer-create "*imagemagic identify*")
    (erase-buffer)
    (call-process "identify" nil "*imagemagic identify*" nil "-verbose" image-file) ;; "-ping" sometimes segfaults for me
    (goto-char (point-min))
    (re-search-forward "Geometry: \\([0-9]+\\)x\\([0-9]+\\)")
    (cons (string-to-number (match-string 1))
          (string-to-number (match-string 2)))))


Aparently the "-ping" flag segfaulted for me when I wrote that
snippet(it doesnt seem to do that now). "-verbose" is similar but gives
much more info and is not as efficient as -ping.

The C code would look vaguely similar to this(for the imagemagick loader):

  MagickWand  *ping_wand;
  int siz_x; int siz_y;
  status = MagickPingImage(ping_wand, filename);
  numimages = MagickGetNumberImages(ping_wand);
  MagickGetImageResolution(ping_wand, &siz_x, &siz_y);

To do this properly I would suppose one needs to invent a lisp structure
compatible with the display spec that can hold image meta data, and have
several implementations of the interface, one for imagemagick, one for
when imagemagick isnt available, that could maybe use "file" etc
ad-overengineering-nauseam. (also call the meta function depending on
the image loader)
  
-- 
Joakim Verona



  reply	other threads:[~2010-09-24 13:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-23 23:43 Slow image display over network Lars Magne Ingebrigtsen
2010-09-24  1:20 ` Leo
2010-09-24  7:58   ` Eli Zaretskii
2010-09-24  8:18     ` Leo
2010-09-24  1:47 ` Daniel Pittman
2010-09-24  7:31   ` Jan Djärv
2010-09-24 11:06   ` David Kastrup
2010-09-24 11:23   ` Lars Magne Ingebrigtsen
2010-09-24 11:51     ` David Kastrup
2010-09-24 11:54       ` Lars Magne Ingebrigtsen
2010-09-24 15:56         ` Chong Yidong
2010-09-24 12:05     ` joakim
2010-09-24 12:21       ` Leo
2010-09-24 12:56       ` Lars Magne Ingebrigtsen
2010-09-24 13:41         ` joakim [this message]
2010-09-24 15:55           ` Lars Magne Ingebrigtsen
2010-09-25  3:35     ` YAMAMOTO Mitsuharu
2010-09-24  6:25 ` Stephen J. Turnbull
2010-09-24  7:11   ` David Kastrup
2010-09-24 11:27     ` Lars Magne Ingebrigtsen
2010-09-24 11:59       ` David Kastrup
2010-09-24 12:57         ` Lars Magne Ingebrigtsen
2010-09-24 14:26         ` Jan Djärv
2010-09-24 11:25   ` Lars Magne Ingebrigtsen
2010-09-24 12:55   ` Lars Magne Ingebrigtsen
2010-09-24  7:44 ` joakim

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

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

  git send-email \
    --in-reply-to=m3pqw3tg0w.fsf@verona.se \
    --to=joakim@verona.se \
    --cc=emacs-devel@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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.