Steps to reproduce: 1. Save the attached TIFF file as attach.tiff. 2. $ emacs -Q attach.tiff & 3. Notice that the image contains multiple frames. 4. Type `f' (image-next-frame). Expected behavior: Switch to the next frame. Emacs 27 works as expected. Actual behavior: Wrong type argument: number-or-marker-p, nil This seems to be a regression introduced by the following change: commit 4aa4a8f9525efa6453816aa588ad178b01df554d Author: Lars Ingebrigtsen Date: Mon May 3 11:45:22 2021 +0200 Speed up animation of non-displayed images * lisp/image.el (image-animate): Only compute the animation data once -- this avoids recomputing the image on every iteration when the image is not displayed (bug#47895). YAMAMOTO Mitsuharu mituharu@math.s.chiba-u.ac.jp In GNU Emacs 28.0.91 (build 2, x86_64-apple-darwin20.6.0, GTK+ Version 3.24.31, cairo version 1.17.4) of 2022-01-24 built on YAMAMOTO-no-iMac-5K.local Repository revision: 6d3608be88e1b30d2d10ee81f14dd485275c20ff Repository branch: emacs-28 Windowing system distributor 'The X.Org Foundation', version 11.0.12011000 System Description: macOS 11.6.2 Configured using: 'configure --without-ns --with-modules LDFLAGS=-L/opt/local/lib CPPFLAGS=-I/opt/local/include' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY KQUEUE PDUMPER PNG RSVG THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB