emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: image-size


From: Eli Zaretskii
Subject: Re: image-size
Date: Thu, 20 Jun 2013 19:01:57 +0300

> From: Lars Magne Ingebrigtsen <address@hidden>
> Date: Thu, 20 Jun 2013 12:04:52 +0200
> 
> If I remember correctly from previous discussions, if you call
> `image-size', Emacs will go through all the normal stuff it does before
> displaying it, including pushing it to the X server, and then ask it how
> big it was.

I don't think so.  Where do you see X calls that "push the image to
the X server"?

I see no display stuff in image.c, only loading of the image and
storing all kinds of metrics of it in an object.  Display happens
later.

> (I'm having a bit of a problem following the logic of lookup_image,
> but it looks complicated.  :-)

The only relevant part is this:

      img->load_failed_p = ! img->type->load (f, img);

This invokes the 'load' method of the relevant image type.

> 2) If so, would someone mind very much if I alter `image-size' to do a
> "fast path" iff a) we're asking for the pixel size, and b) we have
> imagemagick compiled it?  If those two things are true, I could add some
> code to just ask imagemagick how big the image is without involving the
> display engine at all, and things would be a lot faster, I imagine.

I see no reason for relying on imagemagick.  You will see in each
'load' method a short fragment of code that finds the image size.  If
you want a "fast path", just add another flag argument to the 'load'
method that tells it to return as soon as it computed the size, and
that's it.

Restricting this to Emacs built with imagemagick would be a
regrettable limitation, IMO.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]