Subject: 27.0.50; image-transform-fit-to-height/-width violates assert
From: Benjamin Riefenstahl <[email-masked]>
To: [email-masked]
Date: Sat, 05 Jan 2019 18:26:06 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

When I resize images, using image-transform-fit-to-height or
image-transform-fit-to-width, the scaling is performed but than
image-transform-check-size is called and signals an error.  This uses
ImageMagick 6.9.7.4 as installed by Debian GNUS/Linux 9.6 (stretch).

Also, because the scale factor is kept globally after that operation (is
that intentional BTW?), loading other images afterwards also runs into
that error, thus image-mode fails to execute and instead in new image
buffers the raw bytes are shown.

I can reproduce this on emacs-26 as well as master with "emacs -Q" with
PBM and with JPEG images.

In GNU Emacs 27.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.11)
 of 2019-01-03 built on arrian
Repository revision: f7ccac9f9d82019d4d5ba3182200422fbc9c7e67
Repository branch: harfbuzz
Windowing system distributor 'The X.Org Foundation', version 11.0.11902000
System Description: Debian GNU/Linux 9 (stretch)

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS GLIB
NOTIFY INOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ LIBOTF
XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM THREADS LCMS2 GMP

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp

Minor modes in effect:
  global-magit-file-mode: t
  magit-file-mode: t
  global-git-commit-mode: t
  async-bytecomp-package-mode: t
  shell-dirtrack-mode: t
  desktop-save-mode: t
  display-time-mode: t
  diff-auto-refine-mode: t
  delete-selection-mode: t
  cua-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Features:
(shadow sort mail-extr emacsbug sendmail pcmpl-unix dirtrack dired-aux
whitespace compile ert pp ewoc man noutline outline tramp-archive
tramp-gvfs zeroconf dbus xml tramp trampver tramp-compat tramp-loaddefs
ucs-normalize parse-time magit-find-file edebug pulse xref project debug
backtrace tabify misearch multi-isearch rect cl-print thingatpt
eieio-opt speedbar sb-image ezimage dframe find-func help-fns
bug-reference magit-obsolete magit-blame magit-stash magit-bisect
magit-remote magit-commit magit-sequence magit-notes magit-worktree
magit-tag magit-merge magit-branch magit-reset magit-collab ghub-graphql
treepy graphql ghub url-http url-gw nsm url-auth url url-proxy
url-privacy url-expand url-methods url-history url-cookie url-domsuf
url-util mailcap magit-files magit-refs magit-status magit magit-repos
magit-apply magit-wip magit-log which-func magit-diff smerge-mode
magit-core magit-autorevert autorevert filenotify magit-process
magit-margin magit-mode git-commit magit-git magit-section magit-utils
crm magit-popup log-edit message rmc puny format-spec rfc822 mml mml-sec
epa gnus-util rmail rmail-loaddefs time-date mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev
mail-utils gmm-utils mailheader pcvs-util add-log with-editor
async-bytecomp async shell pcomplete dash rng-xsd xsd-regexp rng-cmpct
rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt
rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap sgml-mode dom
nxml-util nxml-enc xmltok make-mode jka-compr image-mode tcl elec-pair
imenu sh-script smie executable desktop frameset highline
benny-calendar-cfg ange-ftp comint ansi-color ring benny-unicode
generic-x cl autoinsert cc-mode cc-fonts cc-guess cc-menus cc-styles
cc-align cc-cmds cc-engine cc-vars cc-defs ps-print ps-print-loaddefs
ps-def lpr advice dired dired-loaddefs benny-x-clipboard disp-table
mm-util mail-prsvr time server protbuf cal-china lunar solar cal-dst
cal-bahai cal-islam cal-hebrew holidays hol-loaddefs vc-git diff-mode
easy-mmode diary-lib diary-loaddefs cal-menu calendar cal-loaddefs
delsel cua-base .loaddefs benny-tools browse-url autoload radix-tree
lisp-mnt mule-util cus-edit cus-start cus-load wid-edit info finder-inf
package let-alist derived pcase cl-extra help-mode easymenu url-handlers
url-parse auth-source cl-seq eieio eieio-core cl-macs eieio-loaddefs
password-cache json map url-vars seq byte-opt gv bytecomp byte-compile
cconv epg epg-config subr-x cl-loaddefs cl-lib tooltip eldoc electric
uniquify ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote threads dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting move-toolbar gtk x-toolkit x
multi-tty make-network-process emacs)