[Top][All Lists]

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

Lazy image converters

From: Evgeny Zajcev
Subject: Lazy image converters
Date: Wed, 12 Feb 2020 17:11:02 +0300

It is a nice feature in Emacs 27 - 'image-convert' type for the images.    To convert unsupported images to format Emacs can understand.

Normally image creation (with 'create-image') is a very lightweight process, Emacs don't read the files or do any heavy things.  All heavy things are done in redisplay, so you could create and insert 1000 images in the buffer with a couple of them visible and this will be fast.

However, with 'image-convert' images, this won't work, because heavy things are done in the 'create-image', not in redisplay.  So Emacs will convert 1000 images at once.

What if we have a lazy image, so its FILE-OR-DATA is calculated at redisplay time.  'image-convert' could utilize this.  One of the approaches to lazy images is to allow FILE-OR-DATA to be a function returning actual file or data.  Redisplay could call this func and substitute the value of FILE-OR-DATA in image spec with the results, kind of caching the results.

What do you think?



reply via email to

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