emacs-devel
[Top][All Lists]
Advanced

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

Re: image-size


From: Lars Magne Ingebrigtsen
Subject: Re: image-size
Date: Thu, 20 Jun 2013 21:52:29 +0200
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3.50 (gnu/linux)

Eli Zaretskii <address@hidden> writes:

> Is this using imagemagick or using libjpeg?

imagemagick.

> If the former, perhaps imagemagick is the only library that needs your
> "fast path".  The other image libraries don't, as they clearly don't
> write to X (otherwise I couldn't have used them on Windows).

I can't see anything in the imagemagick code that talks to X, so I think
it's a general Emacs image thingie.

Anybody?

Anyway, this has led me to consider this a bit more.  Sure, this is
faster than 46 seconds:

(benchmark-elapse (image-size (create-image 
"/home/larsi/Catalogue/html/scans/BAD0013/BAD0013-1-l.jpg") t))
=> 0.226372938

But on the other hand, the next time we open the file to scale it down,
we'll have to decode the image yet again, which will take 0.23 seconds
once again.

Wouldn't it be nice if we could just pass in :max-width and :max-height
to `create-image', and `put-image' would then respect this when actually
creating the image?

Then the image would only have to be decoded once, and we'd have the
best of both worlds.  All other uses of `image-size' that I can see in
shr are for images that are or will definitely be inserted, so they'll
already have been (or will be) transferred over X.

So it fits my use case, and will make displaying sensibly-sized images
fast and convenient in general.  (If you have imagemagick, that is.
Most of the other image renderers don't support resizing, and ignore
:width and :height, so they should also ignore :max-width and
:max-height.)

Opinions?

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



reply via email to

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