all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: George Huebner <george@feyor.sh>
To: 71913@debbugs.gnu.org
Subject: bug#71913: 29.1; shr: shr-resize-image does not behave as expected
Date: Wed, 03 Jul 2024 01:37:52 -0500	[thread overview]
Message-ID: <m2a5izyo8v.fsf@feyor.sh> (raw)

I noticed an issue with =shr-max-image-proportion= wherein images 
would be correctly resized on initial load, but would then appear 
much larger.
I suspected this was an issue with caching, and sure enough, 
either disabling the cache with ~(setq shr-ignore-cache t)~ or 
manually deleting images from the cache results in images 
displaying correctly.
This unanswered 
[[https://www.reddit.com/r/emacs/comments/esa3x5/image_scaling_in_elfeed_entry_window/][Reddit 
post]] seems to corroborate this behaviour.
It looks like it might be because of the codepath taken in 
~shr-tag-img~ wherein a cache miss results in the creation of a 
placeholder image; I had some trouble with edebug though, so 
that's just an educated guess.

Here's a minimal reproducible example (credit to Sacha Chua):
#+begin_src elisp :eval no
;; run this (image is very large), run again many times without 
   killing *test* (image is correct size), kill *test* and run 
   again (image is large again)
;; won't observe this behaviour if you disable cache
;; (setq shr-ignore-cache t)
(setq shr-max-image-proportion 0.5)
(with-current-buffer (get-buffer-create "*test*")
  (erase-buffer)
  (insert "<img 
  src=\"https://upload.wikimedia.org/wikipedia/commons/8/83/The_GNU_logo.png\">")
  (shr-insert-document (libxml-parse-html-region (point-min) 
  (point-max)))
  (display-buffer (current-buffer)))
#+end_src elisp

I also observed this behaviour on Emacs master (667ca66), but I 
daily drive 29.1.
In GNU Emacs 29.1 (build 1, aarch64-apple-darwin23.4.0, Carbon 
Version
170 AppKit 2487.5)
Windowing system distributor 'Apple Inc.', version 14.4.0
System Description:  macOS 14.4

Configured using:
 'configure
 --prefix=/nix/store/ismv7jzf3hcqziq5bpjfs54zd4qfjjn7-emacs-mac-macport-29.1
 --disable-build-details --with-modules --without-gif 
 --without-jpeg
 --without-png --without-tiff --without-x --without-xpm
 '--enable-mac-app=$$out/Applications' --with-gnutls --with-mac
 --with-xml2 --without-ns --with-compress-install
 --with-toolkit-scroll-bars --with-native-compilation
 --without-imagemagick --with-mailutils --without-small-ja-dic
 --with-tree-sitter --without-xinput2 --without-xwidgets 
 --without-dbus
 --without-selinux --with-xwidgets'





             reply	other threads:[~2024-07-03  6:37 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-03  6:37 George Huebner [this message]
2024-07-03 15:48 ` bug#71913: 29.1; shr: shr-resize-image does not behave as expected Jim Porter
     [not found]   ` <m25xtmz0fj.fsf@feyor.sh>
2024-07-05 18:11     ` Jim Porter
2024-07-10 19:02       ` George Huebner
2024-07-11 23:51         ` Jim Porter
2024-07-12  5:58           ` Eli Zaretskii
2024-07-13  4:11             ` Jim Porter
2024-07-13  6:20               ` Eli Zaretskii
2024-07-13 17:29                 ` Jim Porter
2024-07-13 17:39                   ` Eli Zaretskii
2024-07-13 18:54                     ` Jim Porter

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=m2a5izyo8v.fsf@feyor.sh \
    --to=george@feyor.sh \
    --cc=71913@debbugs.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.