reddit / emacs
Slow image display
Hastrack · 2022-01-28 13:31
My Emacs become really slow when displaying images, specially in .org files with inline-images. I don't know if it's a common thing, so how do I improve that?
Obs: I have Emacs with native compilation, so in general my Emacs performs really well, but not with images displaying
Danrobi1 · 2022-01-28 14:16
This works for `eww` and `elfeed` not sure for org-mode.
- (setq shr-inhibit-images '0)
Hastrack · 2022-01-28 14:19
Thanks, I have it in my config, but what I would like is to have images displayed and without lagging
eli-zaretskii · 2022-01-28 14:50
What exactly "becomes slow"? And how many images do you have in a buffer before it becomes slow?
Hastrack · 2022-01-28 14:59
When I have an image and try to scroll or go to the next line, it takes a long time to do so and blocks the Emacs session.
One image is sufficient to have it slow down Emacs.
oantolin · 2022-01-28 17:46
As always, first try to figure out if the problem is your own fault: run `emacs -q` and see if the problem occurs there. If not, then it's something in your configuration. You can then try the bisection method to figure out how you're causing the problem: comment out have your configuration and see if you can reproduce the problem, etc. The [bug-hunter](https://github.com/Malabarba/elisp-bug-hunter) package partly automates this process.
Hastrack · 2022-01-28 17:49
Tested with `emacs -q` and had same results
ftrx · 2022-01-28 19:54
IME images in Emacs buffers are extremely limited, on static (no scrolling) usage, in dedicated buffer (like opening an image from dired) does work enough also for large images, just slow to resize ("zoom") due to the underline ImageMagick machining, on org-mode scrolling does not work well in general but work just enough for *small* images, to you might like `#+attr_org: :width 700` (change the amount of px) just above an inline-image to choose a good pre-defined size without touching the image.
Unfortunately Emacs buffers are not canvas, thanks to that are lightweight, they can be used as "generic in-ram storage" programmatically, ad dumb terminals without much hassle but they are not really suited for "modern contents" like images, animations etc...
eli-zaretskii · 2022-01-28 20:01
Activate the Lisp profiler to see what takes most of the time.
oantolin · 2022-01-28 21:41
So not your fault! Congratulations. Sadly, this also means it'll be harder to solve.
7890yuiop · 2022-01-28 23:10
Does the problem occur with a very small image?
If not, where is the threshold for the problem?
yantar92 · 2022-01-30 12:47
Can you provide an example org file?
Hastrack · 2022-01-30 15:17
I tested, and the lag doesn't happen with .svg files, even a big one.
7890yuiop · 2022-01-30 21:32
Good additional info, although not really what I'd asked (unless you're indicating that you've now tested all kinds of formats and sizes, and .svg images were the *only* case that doesn't produce the issue?).
Admittedly I assumed that you were talking about raster images in the first place; but I do still get that impression, and it's not obvious whether you've tried various sizes (including very small) of those.
7890yuiop · 2022-01-30 22:12
Tangentially, 27.1 dropped ImageMagick as a standard image processor. You can still build with it, but by default other options are preferred. See the NEWS file for Emacs 27 and search for ImageMagick for a number of different entries.