GNU bug report logs - #80101
30.2; [PATCH] NS: Add native image support for HEIF, SVG and WEBP on GNUstep

Previous Next

Package: emacs;

Reported by: Yavor Doganov <yavor <at> gnu.org>

Date: Wed, 31 Dec 2025 06:28:02 UTC

Severity: normal

Tags: patch

Found in version 30.2

To reply to this bug, email your comments to 80101 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to yavor <at> gnu.org, bug-gnu-emacs <at> gnu.org:
bug#80101; Package emacs. (Wed, 31 Dec 2025 06:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Yavor Doganov <yavor <at> gnu.org>:
New bug report received and forwarded. Copy sent to yavor <at> gnu.org, bug-gnu-emacs <at> gnu.org. (Wed, 31 Dec 2025 06:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Yavor Doganov <yavor <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.2; [PATCH] NS: Add native image support for HEIF, SVG and WEBP on
 GNUstep
Date: Wed, 31 Dec 2025 08:27:19 +0200
[Message part 1 (text/plain, inline)]
There is a certain discrepancy between the Cocoa and GNUstep
implementations -- the former can handle more image formats natively.
I think this should be rectified, and it's a worthy goal to avoid
linking Emacs with additional image libraries if the support can be
provided by the underlying toolkit.

As it stands now, to support SVG (for example) on GNUstep, you have to
build with --with-rsvg and the RSVG library is not available on some
architectures (basically all those systems that do not support Rust).

FYI, GNUstep GUI supports the following formats:

TIFF:        always supported (OpenStep API requirement)
GIF:         yes if built with --enable-(ungif|libgif) (on by default)
PNG:         yes if built with --enable-png (on by default)
JPEG:        yes if built with --enable-jpeg (on by default)

HEIF, SVG, WEBP and many other image formats are supported if
gnustep-gui was built with --enable-imagemagick (off by default).
This is how the Debian gnustep-gui package is built.

I have tested the attached patch with the configuration options below.

P.S.  I tried to follow the style of the code block where I made
      changes; there are some inconsistencies.

In GNU Emacs 30.2 (build 2, x86_64-pc-linux-gnu, NS
 gnustep-gui-0.32.0) of 2025-12-05, modified by Debian built on
 patilan
Windowing system distributor 'GNU', version 10.3.32
System Description: Debian GNU/Linux forky/sid

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/30.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/30.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --build
 x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib
 --libexecdir=/usr/libexec --localstatedir=/var/lib
 --infodir=/usr/share/info --mandir=/usr/share/man --with-libsystemd
 --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/30.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/30.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils --with-ns
 --disable-ns-self-contained --without-gif --without-jpeg
 --without-png --without-rsvg --without-tiff --without-webp 'CFLAGS=-g
 -O2 -Werror=implicit-function-declaration
 -ffile-prefix-map=/build/reproducible-path/emacs-30.2+1=. -fstack-protector-strong
 -fstack-clash-protection -Wformat -Werror=format-security
 -fcf-protection -Wall' 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2'
 LDFLAGS=-Wl,-z,relro'
[0001-NS-Add-native-image-support-for-HEIF-SVG-and-WEBP-on.patch (text/plain, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#80101; Package emacs. (Sat, 10 Jan 2026 11:53:02 GMT) Full text and rfc822 format available.

Message #8 received at 80101 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Yavor Doganov <yavor <at> gnu.org>, Alan Third <alan <at> idiocy.org>
Cc: 80101 <at> debbugs.gnu.org
Subject: Re: bug#80101: 30.2;
 [PATCH] NS: Add native image support for HEIF, SVG and WEBP on GNUstep
Date: Sat, 10 Jan 2026 13:52:12 +0200
> Cc: yavor <at> gnu.org
> Date: Wed, 31 Dec 2025 08:27:19 +0200
> From: Yavor Doganov <yavor <at> gnu.org>
> 
> There is a certain discrepancy between the Cocoa and GNUstep
> implementations -- the former can handle more image formats natively.
> I think this should be rectified, and it's a worthy goal to avoid
> linking Emacs with additional image libraries if the support can be
> provided by the underlying toolkit.
> 
> As it stands now, to support SVG (for example) on GNUstep, you have to
> build with --with-rsvg and the RSVG library is not available on some
> architectures (basically all those systems that do not support Rust).
> 
> FYI, GNUstep GUI supports the following formats:
> 
> TIFF:        always supported (OpenStep API requirement)
> GIF:         yes if built with --enable-(ungif|libgif) (on by default)
> PNG:         yes if built with --enable-png (on by default)
> JPEG:        yes if built with --enable-jpeg (on by default)
> 
> HEIF, SVG, WEBP and many other image formats are supported if
> gnustep-gui was built with --enable-imagemagick (off by default).
> This is how the Debian gnustep-gui package is built.
> 
> I have tested the attached patch with the configuration options below.
> 
> P.S.  I tried to follow the style of the code block where I made
>       changes; there are some inconsistencies.

Thanks.

Alan, may I ask you to review this and comment?  TIA.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#80101; Package emacs. (Sat, 10 Jan 2026 13:15:02 GMT) Full text and rfc822 format available.

Message #11 received at 80101 <at> debbugs.gnu.org (full text, mbox):

From: Alan Third <alan <at> idiocy.org>
To: Yavor Doganov <yavor <at> gnu.org>
Cc: 80101 <at> debbugs.gnu.org
Subject: Re: bug#80101: 30.2; [PATCH] NS: Add native image support for HEIF,
 SVG and WEBP on GNUstep
Date: Sat, 10 Jan 2026 13:14:40 +0000
On Wed, Dec 31, 2025 at 08:27:19AM +0200, Yavor Doganov wrote:
> There is a certain discrepancy between the Cocoa and GNUstep
> implementations -- the former can handle more image formats natively.
> I think this should be rectified, and it's a worthy goal to avoid
> linking Emacs with additional image libraries if the support can be
> provided by the underlying toolkit.
> 
> As it stands now, to support SVG (for example) on GNUstep, you have to
> build with --with-rsvg and the RSVG library is not available on some
> architectures (basically all those systems that do not support Rust).
> 
> FYI, GNUstep GUI supports the following formats:
> 
> TIFF:        always supported (OpenStep API requirement)
> GIF:         yes if built with --enable-(ungif|libgif) (on by default)
> PNG:         yes if built with --enable-png (on by default)
> JPEG:        yes if built with --enable-jpeg (on by default)
> 
> HEIF, SVG, WEBP and many other image formats are supported if
> gnustep-gui was built with --enable-imagemagick (off by default).
> This is how the Debian gnustep-gui package is built.
> 
> I have tested the attached patch with the configuration options below.
> 
> P.S.  I tried to follow the style of the code block where I made
>       changes; there are some inconsistencies.


>  #if defined (HAVE_WEBP)						\
>    || (defined (HAVE_NATIVE_IMAGE_API)				\
> -      && ((defined (HAVE_NS) && defined (NS_IMPL_COCOA))	\
> -	  || defined (HAVE_HAIKU)))
> +      && (defined (HAVE_NS) || defined (HAVE_HAIKU)))
>    DEFSYM (Qwebp, "webp");
>    DEFSYM (Qwebpdemux, "webpdemux");
> +#if !defined (NS_IMPL_GNUSTEP) || defined (HAVE_WEBP)
>    add_image_type (Qwebp);
> +#else
> +
> +  /* On GNUstep, WEBP support is provided via ImageMagick only if
> +     gnustep-gui is built with --enable-imagemagick.  */
> +  if (image_can_use_native_api (Qwebp))
> +    add_image_type (Qwebp);
> +#endif /* NS_IMPL_GNUSTEP && !HAVE_WEBP */
>  #endif

I'm not sure the call to "image_can_use_native_api" is necessary for
any of these. It's called when an image is loaded. I see it's there
for SVG on Haiku, but not for anything else. I don't know why it's
there for Haiku, but AFAIK older versions of macOS don't natively
support the likes of HEIC or WEBP and we don't have any checks for
them here.

Other than that, which I don't think is a showstopper, it looks good.
-- 
Alan Third




This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.