From 87ea8847484b82d620813672d4a1980a607a97dd Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Tue, 29 Jul 2025 09:42:21 +0300 Subject: [PATCH] Minor image-convert file types related changes (bug#79109) * lisp/files.el (auto-mode-alist): Add ".avif" to the list of image file types supported by 'image-convert'. Remove duplicate entry for ".webp" that was added at the top in the list of natively supported image types. * lisp/image.el (imagemagick-enabled-types): Add AVIF and WEBP (the latest for the case when native libs are not installed). * lisp/image/image-converter.el (image-converter--converters): Add "-layers merge" to the imagemagick convert command line. --- lisp/files.el | 2 +- lisp/image.el | 4 ++-- lisp/image/image-converter.el | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index c05f4fa0e4a..23a8d83ab28 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3248,6 +3248,7 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\|SQUASHFS\\)\\'" . ;; and after the .scm.[0-9] and CVS' . patterns too. ("\\.[1-9]\\'" . nroff-mode) ;; Image file types probably supported by `image-convert'. + ("\\.avif\\'" . image-mode) ("\\.art\\'" . image-mode) ("\\.avs\\'" . image-mode) ("\\.bmp\\'" . image-mode) @@ -3287,7 +3288,6 @@ ARC\\|ZIP\\|LZH\\|LHA\\|ZOO\\|[JEW]AR\\|XPI\\|RAR\\|CBR\\|7Z\\|SQUASHFS\\)\\'" . ("\\.six\\'" . image-mode) ("\\.tga\\'" . image-mode) ("\\.wbmp\\'" . image-mode) - ("\\.webp\\'" . image-mode) ("\\.wmf\\'" . image-mode) ("\\.wpg\\'" . image-mode) ("\\.xcf\\'" . image-mode) diff --git a/lisp/image.el b/lisp/image.el index 40d1364430f..b95dd230914 100644 --- a/lisp/image.el +++ b/lisp/image.el @@ -1174,14 +1174,14 @@ has no effect." :version "24.3") (defcustom imagemagick-enabled-types - '(3FR ARW AVS BMP BMP2 BMP3 CAL CALS CMYK CMYKA CR2 CRW + '(3FR ARW AVIF AVS BMP BMP2 BMP3 CAL CALS CMYK CMYKA CR2 CRW CUR CUT DCM DCR DCX DDS DJVU DNG DPX EXR FAX FITS GBR GIF GIF87 GRB HRZ ICB ICO ICON J2C JNG JP2 JPC JPEG JPG JPX K25 KDC MIFF MNG MRW MSL MSVG MTV NEF ORF OTB PBM PCD PCDS PCL PCT PCX PDB PEF PGM PICT PIX PJPEG PNG PNG24 PNG32 PNG8 PNM PPM PSD PTIF PWP RAF RAS RBG RGB RGBA RGBO RLA RLE SCR SCT SFW SGI SIX SR2 SRF SUN SVG SVGZ TGA TIFF TIFF64 TILE TIM TTF - UYVY VDA VICAR VID VIFF VST WBMP WPG X3F XBM XC XCF XPM XV + UYVY VDA VICAR VID VIFF VST WBMP WEBP WPG X3F XBM XC XCF XPM XV XWD YCbCr YCbCrA YUV) "List of ImageMagick types to treat as images. Each list element should be a string or symbol, representing one diff --git a/lisp/image/image-converter.el b/lisp/image/image-converter.el index 5fe52b98a28..c067ea0524d 100644 --- a/lisp/image/image-converter.el +++ b/lisp/image/image-converter.el @@ -65,7 +65,8 @@ not, the conversion will fail." (defvar image-converter--converters '((graphicsmagick :command ("gm" "convert") :probe ("-list" "format")) (ffmpeg :command "ffmpeg" :probe "-decoders") - (imagemagick :command "convert" :probe ("-list" "format"))) + ;; "-layers merge" flattens visible layers in e.g. Gimp XCF files. + (imagemagick :command ("convert" "-layers" "merge") :probe ("-list" "format"))) "List of supported image converters to try and required command-line switches.") (defvar image-converter--extra-converters (make-hash-table :test #'equal))