all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#51381: HEIF image format support
@ 2021-10-25  3:38 Stefan Kangas
  2021-10-25  4:05 ` YAMAMOTO Mitsuharu
  2021-10-25 15:22 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 37+ messages in thread
From: Stefan Kangas @ 2021-10-25  3:38 UTC (permalink / raw)
  To: 51381

Severity: wishlist

Apple seems to have moved over to use the HEIF image format.  It seems
like Canon is also trying to push this for their cameras, and it is
being presented as a "JPEG replacement".

Whatever we think of that, this means that many unsuspecting Emacs will
soon be faced with such images.

For example, I stumbled upon this comment from one user:

    "I have used image-dired from time to time, but less so now since
    Apple's default image type is .heic. I can't open these images in
    the emacs-mac (Mitsuharo's version).

    "Is there any work ongoing to natively open .heic in Emacs?"

    https://www.reddit.com/r/emacs/comments/nzxms5/comment/h1vbepq/

GIMP, imagemagick, krita, nomacs, etc. have added HEIC support using the
LGPLv3 licensed library libheif.[1]

See more about where it is supported here:

https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format#Support

Should Emacs have built-in support for the HEIC image format?  Would it
be welcome if someone wrote up a patch for it?

Footnotes:
[1]  https://github.com/strukturag/libheif





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-25  3:38 bug#51381: HEIF image format support Stefan Kangas
@ 2021-10-25  4:05 ` YAMAMOTO Mitsuharu
  2021-10-25  8:50   ` YAMAMOTO Mitsuharu
  2021-10-25 15:22 ` Lars Ingebrigtsen
  1 sibling, 1 reply; 37+ messages in thread
From: YAMAMOTO Mitsuharu @ 2021-10-25  4:05 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 51381

On Mon, 25 Oct 2021 12:38:00 +0900,
Stefan Kangas wrote:
> 
> For example, I stumbled upon this comment from one user:
> 
>     "I have used image-dired from time to time, but less so now since
>     Apple's default image type is .heic. I can't open these images in
>     the emacs-mac (Mitsuharo's version).

As the Mac port supports image types the Image I/O framework can
handle, HEIC images can be displayed on macOS 10.15 and later.  You
need the following setting mentioned in the info node "Mac Images":

     (when (and (image-type-available-p 'image-io)
                (not (boundp 'imagemagick-render-type)))
        ;; Image I/O is used as a fallback of ImageMagick.
        (setq imagemagick-enabled-types t)
        (setq imagemagick-types-inhibit
              (cons 'XML (delq 'PDF imagemagick-types-inhibit)))
        (imagemagick-register-types))

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-25  4:05 ` YAMAMOTO Mitsuharu
@ 2021-10-25  8:50   ` YAMAMOTO Mitsuharu
  0 siblings, 0 replies; 37+ messages in thread
From: YAMAMOTO Mitsuharu @ 2021-10-25  8:50 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 51381

On Mon, 25 Oct 2021 13:05:45 +0900,
YAMAMOTO Mitsuharu wrote:
> 
> As the Mac port supports image types the Image I/O framework can
> handle, HEIC images can be displayed on macOS 10.15 and later.

Actually, HEIC is supported on macOS 10.13 and later; HEICS support is
added in macOS 10.15.

				     YAMAMOTO Mitsuharu
				mituharu@math.s.chiba-u.ac.jp





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-25  3:38 bug#51381: HEIF image format support Stefan Kangas
  2021-10-25  4:05 ` YAMAMOTO Mitsuharu
@ 2021-10-25 15:22 ` Lars Ingebrigtsen
  2021-10-25 15:34   ` Stefan Kangas
  2021-10-25 21:36   ` Glenn Morris
  1 sibling, 2 replies; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-25 15:22 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 51381

Stefan Kangas <stefan@marxist.se> writes:

> Apple seems to have moved over to use the HEIF image format.  It seems
> like Canon is also trying to push this for their cameras, and it is
> being presented as a "JPEG replacement".
>
> Whatever we think of that, this means that many unsuspecting Emacs will
> soon be faced with such images.

Probably mostly Apple users, and has already been noted, Emacs on Macos
already understands all image formats that the OS supports.

> Should Emacs have built-in support for the HEIC image format?  Would it
> be welcome if someone wrote up a patch for it?

I think it's too niche to warrant adding full-fledged support for it,
but image-convert.el supports it (if the external utilities do).  I've
now added .heic to auto-mode-alist so that this should work
automatically.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-25 15:22 ` Lars Ingebrigtsen
@ 2021-10-25 15:34   ` Stefan Kangas
  2021-10-25 15:46     ` Lars Ingebrigtsen
  2021-10-25 21:36   ` Glenn Morris
  1 sibling, 1 reply; 37+ messages in thread
From: Stefan Kangas @ 2021-10-25 15:34 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 51381

Lars Ingebrigtsen <larsi@gnus.org> writes:

> I think it's too niche to warrant adding full-fledged support for it,
> but image-convert.el supports it (if the external utilities do).  I've
> now added .heic to auto-mode-alist so that this should work
> automatically.

Sounds good to me.  Could we back-port that fix to emacs-28?





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-25 15:34   ` Stefan Kangas
@ 2021-10-25 15:46     ` Lars Ingebrigtsen
  2021-10-25 19:37       ` Stefan Kangas
  0 siblings, 1 reply; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-25 15:46 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 51381

Stefan Kangas <stefan@marxist.se> writes:

> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> I think it's too niche to warrant adding full-fledged support for it,
>> but image-convert.el supports it (if the external utilities do).  I've
>> now added .heic to auto-mode-alist so that this should work
>> automatically.
>
> Sounds good to me.  Could we back-port that fix to emacs-28?

Uhm...  I guess it does sound unlikely to regress anything, but I think
it's too late in the release cycle to add even that.  I mean, there
could be someone out there that has .heic files that are something else.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-25 15:46     ` Lars Ingebrigtsen
@ 2021-10-25 19:37       ` Stefan Kangas
  2021-10-25 19:39         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 37+ messages in thread
From: Stefan Kangas @ 2021-10-25 19:37 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 51381

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Uhm...  I guess it does sound unlikely to regress anything, but I think
> it's too late in the release cycle to add even that.  I mean, there
> could be someone out there that has .heic files that are something else.

OK, I understand.  Thanks for fixing this on master!

I don't think there is anything more to do here, is there?  The fix you
installed is all there is to it?





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-25 19:37       ` Stefan Kangas
@ 2021-10-25 19:39         ` Lars Ingebrigtsen
  2021-10-28 21:00           ` Stefan Kangas
  2021-10-30 16:37           ` Stefan Kangas
  0 siblings, 2 replies; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-25 19:39 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: 51381

Stefan Kangas <stefan@marxist.se> writes:

> I don't think there is anything more to do here, is there?  The fix you
> installed is all there is to it?

Yup.  :-)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-25 15:22 ` Lars Ingebrigtsen
  2021-10-25 15:34   ` Stefan Kangas
@ 2021-10-25 21:36   ` Glenn Morris
  2021-10-25 21:43     ` Lars Ingebrigtsen
  1 sibling, 1 reply; 37+ messages in thread
From: Glenn Morris @ 2021-10-25 21:36 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Stefan Kangas, 51381

Lars Ingebrigtsen wrote:

> Probably mostly Apple users, and has already been noted, Emacs on Macos
> already understands all image formats that the OS supports.

The previous comments refer to image support in the "Mac port",
which is not mainline GNU Emacs. (I have always thought it a confusing
name.)





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-25 21:36   ` Glenn Morris
@ 2021-10-25 21:43     ` Lars Ingebrigtsen
  2021-10-26 10:15       ` Alan Third
  0 siblings, 1 reply; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-25 21:43 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Alan Third, Stefan Kangas, 51381

Glenn Morris <rgm@gnu.org> writes:

> The previous comments refer to image support in the "Mac port",
> which is not mainline GNU Emacs. (I have always thought it a confusing
> name.)

Oh!  Hm.  Well, I thought mainline Emacs also used the OS facilities to
render images, but I may well be wrong.  Alan?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-25 21:43     ` Lars Ingebrigtsen
@ 2021-10-26 10:15       ` Alan Third
  2021-10-27 13:06         ` Lars Ingebrigtsen
  0 siblings, 1 reply; 37+ messages in thread
From: Alan Third @ 2021-10-26 10:15 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Glenn Morris, Stefan Kangas, 51381

On Mon, Oct 25, 2021 at 11:43:01PM +0200, Lars Ingebrigtsen wrote:
> Glenn Morris <rgm@gnu.org> writes:
> 
> > The previous comments refer to image support in the "Mac port",
> > which is not mainline GNU Emacs. (I have always thought it a confusing
> > name.)
> 
> Oh!  Hm.  Well, I thought mainline Emacs also used the OS facilities to
> render images, but I may well be wrong.  Alan?

Yeah, but we need to teach Emacs about the image format. I'm not sure
how to do that. I once tried to teach it to load PDFs using *step
functionality and failed miserably. This is the same.
-- 
Alan Third





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-26 10:15       ` Alan Third
@ 2021-10-27 13:06         ` Lars Ingebrigtsen
  2021-10-27 16:13           ` Alan Third
  0 siblings, 1 reply; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-27 13:06 UTC (permalink / raw)
  To: Alan Third; +Cc: Glenn Morris, Stefan Kangas, 51381

Alan Third <alan@idiocy.org> writes:

> Yeah, but we need to teach Emacs about the image format. I'm not sure
> how to do that. I once tried to teach it to load PDFs using *step
> functionality and failed miserably. This is the same.

Is there any chance we can entice the MacPorts people to fix this in
mainline Emacs?  (I'm just wildly assuming that this works there,
without having actually had a peek.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-27 13:06         ` Lars Ingebrigtsen
@ 2021-10-27 16:13           ` Alan Third
  2021-10-27 16:25             ` Lars Ingebrigtsen
  2021-11-26 13:02             ` Alan Third
  0 siblings, 2 replies; 37+ messages in thread
From: Alan Third @ 2021-10-27 16:13 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Glenn Morris, Stefan Kangas, 51381

On Wed, Oct 27, 2021 at 03:06:14PM +0200, Lars Ingebrigtsen wrote:
> Alan Third <alan@idiocy.org> writes:
> 
> > Yeah, but we need to teach Emacs about the image format. I'm not sure
> > how to do that. I once tried to teach it to load PDFs using *step
> > functionality and failed miserably. This is the same.
> 
> Is there any chance we can entice the MacPorts people to fix this in
> mainline Emacs?  (I'm just wildly assuming that this works there,
> without having actually had a peek.)

When you say MacPorts do you actually mean the Emacs Mac port by
Yamamoto Mitsuharu? I'm not sure he'd care much for working on the NS
port, but you can always ask.

FWIW NSImage (on macOS) is already capable of loading an heic file, if
we just point it to it. I thought all we needed to do is add heic to
ns_can_use_native_image_api in nsimage.m and then load an image with
the type of "heic" or whatever, but it doesn't work and I'm not sure
what else I need to do. Probably define heic as a type elsewhere.

But aside from all of that, is heic supported on a Free OS yet?

-- 
Alan Third





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-27 16:13           ` Alan Third
@ 2021-10-27 16:25             ` Lars Ingebrigtsen
  2021-10-27 19:14               ` Stefan Kangas
  2021-11-26 13:02             ` Alan Third
  1 sibling, 1 reply; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-27 16:25 UTC (permalink / raw)
  To: Alan Third; +Cc: Glenn Morris, Stefan Kangas, 51381

Alan Third <alan@idiocy.org> writes:

> When you say MacPorts do you actually mean the Emacs Mac port by
> Yamamoto Mitsuharu? I'm not sure he'd care much for working on the NS
> port, but you can always ask.

Yes, that's that what/who I was thinking of...  Macports is something
else, come to think of it.  :-)

> FWIW NSImage (on macOS) is already capable of loading an heic file, if
> we just point it to it. I thought all we needed to do is add heic to
> ns_can_use_native_image_api in nsimage.m and then load an image with
> the type of "heic" or whatever, but it doesn't work and I'm not sure
> what else I need to do. Probably define heic as a type elsewhere.
>
> But aside from all of that, is heic supported on a Free OS yet?

Yes, imagemagick supports it, so (via image-convert and the external
commands) Emacs can display heic on Debian, for instance.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-27 16:25             ` Lars Ingebrigtsen
@ 2021-10-27 19:14               ` Stefan Kangas
  2021-10-28 21:14                 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 37+ messages in thread
From: Stefan Kangas @ 2021-10-27 19:14 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Alan Third; +Cc: Glenn Morris, 51381

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Yes, imagemagick supports it, so (via image-convert and the external
> commands) Emacs can display heic on Debian, for instance.

Just to point out that we prefer GraphicsMagick to ImageMagick if it is
installed.  Which is a good thing: it has better performance, security
track record, and fewer dependencies.





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-25 19:39         ` Lars Ingebrigtsen
@ 2021-10-28 21:00           ` Stefan Kangas
  2021-10-29  5:27             ` Eli Zaretskii
  2021-10-30 16:37           ` Stefan Kangas
  1 sibling, 1 reply; 37+ messages in thread
From: Stefan Kangas @ 2021-10-28 21:00 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 51381

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Yup.  :-)

I finally got around to testing this, with an image from

    https://github.com/nokiatech/heif_conformance

on current master:

0. curl --output /tmp/C001.heic
https://raw.githubusercontent.com/nokiatech/heif_conformance/master/conformance_files/C001.heic
1. emacs -Q --eval '(setq image-use-external-converter t)' /tmp/C001.heic

But I get the error message "Unknown image type", and nothing else.

I also tried image1.heic from here:

    https://github.com/tigranbs/test-heic-images

with the same result.

Am I doing something wrong?  I have all three of GraphicsMagick, ffmpeg
and ImageMagick installed AFAICT.





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-27 19:14               ` Stefan Kangas
@ 2021-10-28 21:14                 ` Lars Ingebrigtsen
  2021-10-28 22:18                   ` Stefan Kangas
  0 siblings, 1 reply; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-28 21:14 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Glenn Morris, Alan Third, 51381

Stefan Kangas <stefan@marxist.se> writes:

>> Yes, imagemagick supports it, so (via image-convert and the external
>> commands) Emacs can display heic on Debian, for instance.
>
> Just to point out that we prefer GraphicsMagick to ImageMagick if it is
> installed.  Which is a good thing: it has better performance, security
> track record, and fewer dependencies.

Yes, GraphicsMagick is better all over.  But as usual, ImageMagick is
first out with support for the new shiny thing -- GraphicsMagick (in
Debian/bookworm, at least) does not support .heic, but ImageMagick does.

Stefan Kangas <stefan@marxist.se> writes:

> 1. emacs -Q --eval '(setq image-use-external-converter t)' /tmp/C001.heic
>
> But I get the error message "Unknown image type", and nothing else.

It probably autodetects GraphicsMagick?  The logic doesn't look for
support per image format, but just uses one of the three.

Try setting `image-converter' to `imagemagick' and restart Emacs.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-28 21:14                 ` Lars Ingebrigtsen
@ 2021-10-28 22:18                   ` Stefan Kangas
  2021-10-29 12:34                     ` Lars Ingebrigtsen
  0 siblings, 1 reply; 37+ messages in thread
From: Stefan Kangas @ 2021-10-28 22:18 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Glenn Morris, Alan Third, 51381

Lars Ingebrigtsen <larsi@gnus.org> writes:

> It probably autodetects GraphicsMagick?  The logic doesn't look for
> support per image format, but just uses one of the three.
>
> Try setting `image-converter' to `imagemagick' and restart Emacs.

Aha!  Yup, that works.

I have three questions:

A) If e.g. GraphicsMagick fails, shouldn't we try falling back to the
   other converters?

B) Could the above error message be better?  For example, could it say
   which image converter(s) we tried?

C) Shouldn't `image-use-external-converter' be t by default?





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-28 21:00           ` Stefan Kangas
@ 2021-10-29  5:27             ` Eli Zaretskii
  2021-10-29 12:35               ` Lars Ingebrigtsen
  0 siblings, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2021-10-29  5:27 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: larsi, 51381

> From: Stefan Kangas <stefan@marxist.se>
> Date: Thu, 28 Oct 2021 14:00:32 -0700
> Cc: 51381@debbugs.gnu.org
> 
>     https://github.com/nokiatech/heif_conformance
> 
> on current master:
> 
> 0. curl --output /tmp/C001.heic
> https://raw.githubusercontent.com/nokiatech/heif_conformance/master/conformance_files/C001.heic
> 1. emacs -Q --eval '(setq image-use-external-converter t)' /tmp/C001.heic
> 
> But I get the error message "Unknown image type", and nothing else.

Why do we prefer external-converter for this, instead of having those
images supported natively?  I thought we wanted to move away of
ImageMagick dependencies?





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-28 22:18                   ` Stefan Kangas
@ 2021-10-29 12:34                     ` Lars Ingebrigtsen
  2021-10-29 13:08                       ` Stefan Kangas
  0 siblings, 1 reply; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-29 12:34 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Glenn Morris, Alan Third, 51381

Stefan Kangas <stefan@marxist.se> writes:

> A) If e.g. GraphicsMagick fails, shouldn't we try falling back to the
>    other converters?

Sure.  We could re-probe the converters when something fails and then
use the other converter, for instance?  Or we could just probe every
time, but keep a table of what we've tried.

Or we could probe all the converters at startup, and maintain a mapping
of which converter does what -- that sounds cleanest.

> B) Could the above error message be better?  For example, could it say
>    which image converter(s) we tried?

Sure.  Patches for a) and b) are welcome.  :-)

> C) Shouldn't `image-use-external-converter' be t by default?

I dunno...  there's security implications.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-29  5:27             ` Eli Zaretskii
@ 2021-10-29 12:35               ` Lars Ingebrigtsen
  2021-10-29 13:08                 ` Stefan Kangas
  2021-10-29 13:28                 ` Eli Zaretskii
  0 siblings, 2 replies; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-29 12:35 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Stefan Kangas, 51381

Eli Zaretskii <eliz@gnu.org> writes:

> Why do we prefer external-converter for this, instead of having those
> images supported natively?  I thought we wanted to move away of
> ImageMagick dependencies?

We don't want to make Emacs depend on All The C Image Libraries That
Exist.  For obscure formats, seldom used, it's fine to use an external
program (if the user wants to).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-29 12:35               ` Lars Ingebrigtsen
@ 2021-10-29 13:08                 ` Stefan Kangas
  2021-10-29 13:19                   ` Glenn Morris
  2021-10-29 13:28                 ` Eli Zaretskii
  1 sibling, 1 reply; 37+ messages in thread
From: Stefan Kangas @ 2021-10-29 13:08 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Eli Zaretskii; +Cc: 51381

Lars Ingebrigtsen <larsi@gnus.org> writes:

> We don't want to make Emacs depend on All The C Image Libraries That
> Exist.  For obscure formats, seldom used, it's fine to use an external
> program (if the user wants to).

How about supporting the GraphicsMagick library instead of or in
addition to ImageMagick?  Or was that already rejected?





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-29 12:34                     ` Lars Ingebrigtsen
@ 2021-10-29 13:08                       ` Stefan Kangas
  0 siblings, 0 replies; 37+ messages in thread
From: Stefan Kangas @ 2021-10-29 13:08 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Glenn Morris, Alan Third, 51381

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Stefan Kangas <stefan@marxist.se> writes:
>
>> A) If e.g. GraphicsMagick fails, shouldn't we try falling back to the
>>    other converters?
>
> Sure.  We could re-probe the converters when something fails and then
> use the other converter, for instance?  Or we could just probe every
> time, but keep a table of what we've tried.
>
> Or we could probe all the converters at startup, and maintain a mapping
> of which converter does what -- that sounds cleanest.
>
>> B) Could the above error message be better?  For example, could it say
>>    which image converter(s) we tried?
>
> Sure.  Patches for a) and b) are welcome.  :-)

OK!  I will open two separate bug reports for that.

>> C) Shouldn't `image-use-external-converter' be t by default?
>
> I dunno...  there's security implications.

That's true.





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-29 13:08                 ` Stefan Kangas
@ 2021-10-29 13:19                   ` Glenn Morris
  2021-10-30 16:21                     ` Stefan Kangas
  0 siblings, 1 reply; 37+ messages in thread
From: Glenn Morris @ 2021-10-29 13:19 UTC (permalink / raw)
  To: Stefan Kangas; +Cc: Lars Ingebrigtsen, 51381

Stefan Kangas wrote:

> How about supporting the GraphicsMagick library instead of or in
> addition to ImageMagick?  Or was that already rejected?

I took no comments in 4+ years as a sign no-one was interested:
https://debbugs.gnu.org/14358





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-29 12:35               ` Lars Ingebrigtsen
  2021-10-29 13:08                 ` Stefan Kangas
@ 2021-10-29 13:28                 ` Eli Zaretskii
  2021-10-29 13:37                   ` Lars Ingebrigtsen
  1 sibling, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2021-10-29 13:28 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: stefan, 51381

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Stefan Kangas <stefan@marxist.se>,  51381@debbugs.gnu.org
> Date: Fri, 29 Oct 2021 14:35:20 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Why do we prefer external-converter for this, instead of having those
> > images supported natively?  I thought we wanted to move away of
> > ImageMagick dependencies?
> 
> We don't want to make Emacs depend on All The C Image Libraries That
> Exist.  For obscure formats, seldom used, it's fine to use an external
> program (if the user wants to).

Is HEIF an "obscure format"?





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-29 13:28                 ` Eli Zaretskii
@ 2021-10-29 13:37                   ` Lars Ingebrigtsen
  2021-10-29 13:54                     ` Eli Zaretskii
  2021-10-29 14:10                     ` Stefan Kangas
  0 siblings, 2 replies; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-29 13:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: stefan, 51381

Eli Zaretskii <eliz@gnu.org> writes:

> Is HEIF an "obscure format"?

Outside of Mac users -- very.  (And on Mac, the OS displays all the
images.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-29 13:37                   ` Lars Ingebrigtsen
@ 2021-10-29 13:54                     ` Eli Zaretskii
  2021-10-29 14:06                       ` Lars Ingebrigtsen
  2021-10-29 14:10                     ` Stefan Kangas
  1 sibling, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2021-10-29 13:54 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: stefan, 51381

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: stefan@marxist.se,  51381@debbugs.gnu.org
> Date: Fri, 29 Oct 2021 15:37:02 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Is HEIF an "obscure format"?
> 
> Outside of Mac users -- very.  (And on Mac, the OS displays all the
> images.)

Then why are you spending so much time on this subject, which AFAIU is
not about Mac?





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-29 13:54                     ` Eli Zaretskii
@ 2021-10-29 14:06                       ` Lars Ingebrigtsen
  2021-10-29 14:13                         ` Eli Zaretskii
  0 siblings, 1 reply; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-29 14:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: stefan, 51381

Eli Zaretskii <eliz@gnu.org> writes:

> Then why are you spending so much time on this subject

Am I?  I wasn't aware.

> , which AFAIU is not about Mac?

It's both about Mac and not.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-29 13:37                   ` Lars Ingebrigtsen
  2021-10-29 13:54                     ` Eli Zaretskii
@ 2021-10-29 14:10                     ` Stefan Kangas
  1 sibling, 0 replies; 37+ messages in thread
From: Stefan Kangas @ 2021-10-29 14:10 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Eli Zaretskii; +Cc: 51381

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> Is HEIF an "obscure format"?

I'm not sure.  Adoption seems to be picking up:

https://en.wikipedia.org/wiki/High_Efficiency_Image_File_Format#Support

> Outside of Mac users -- very.  (And on Mac, the OS displays all the
> images.)

But note that interoperability with Mac (and iOS, where you explicitly
have to turn HEIF off if you don't want it) is pretty important even to
GNU/Linux users.

But I also don't see it as a major problem (just a small one) if we give
it a year or three to see if this format really starts to really pick up.





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-29 14:06                       ` Lars Ingebrigtsen
@ 2021-10-29 14:13                         ` Eli Zaretskii
  2021-10-29 14:15                           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 37+ messages in thread
From: Eli Zaretskii @ 2021-10-29 14:13 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: stefan, 51381

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: stefan@marxist.se,  51381@debbugs.gnu.org
> Date: Fri, 29 Oct 2021 16:06:48 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > Then why are you spending so much time on this subject
> 
> Am I?  I wasn't aware.

This thread amassed 3 dozens of messages.





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-29 14:13                         ` Eli Zaretskii
@ 2021-10-29 14:15                           ` Lars Ingebrigtsen
  0 siblings, 0 replies; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-29 14:15 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: stefan, 51381

Eli Zaretskii <eliz@gnu.org> writes:

>> > Then why are you spending so much time on this subject
>> 
>> Am I?  I wasn't aware.
>
> This thread amassed 3 dozens of messages.

I'm very efficient.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-29 13:19                   ` Glenn Morris
@ 2021-10-30 16:21                     ` Stefan Kangas
  0 siblings, 0 replies; 37+ messages in thread
From: Stefan Kangas @ 2021-10-30 16:21 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Lars Ingebrigtsen, 51381

Glenn Morris <rgm@gnu.org> writes:

> Stefan Kangas wrote:
>
>> How about supporting the GraphicsMagick library instead of or in
>> addition to ImageMagick?  Or was that already rejected?
>
> I took no comments in 4+ years as a sign no-one was interested:
> https://debbugs.gnu.org/14358

Thanks, Glenn.  I will reopen that bug to see if the situation has
changed since 2014.





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-25 19:39         ` Lars Ingebrigtsen
  2021-10-28 21:00           ` Stefan Kangas
@ 2021-10-30 16:37           ` Stefan Kangas
  1 sibling, 0 replies; 37+ messages in thread
From: Stefan Kangas @ 2021-10-30 16:37 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 51381

close 51381 29.1
thanks

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Stefan Kangas <stefan@marxist.se> writes:
>
>> I don't think there is anything more to do here, is there?  The fix you
>> installed is all there is to it?
>
> Yup.  :-)

I'm therefore closing this bug.  There was some discussion about how the
native support for HEIC fails on macOS, but that's a separate issue.  If
anyone wants to look into it, I recommend opening a new bug report.





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-10-27 16:13           ` Alan Third
  2021-10-27 16:25             ` Lars Ingebrigtsen
@ 2021-11-26 13:02             ` Alan Third
  2021-11-26 14:08               ` Lars Ingebrigtsen
  2021-12-22 20:53               ` Alan Third
  1 sibling, 2 replies; 37+ messages in thread
From: Alan Third @ 2021-11-26 13:02 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Glenn Morris, Stefan Kangas, 51381

[-- Attachment #1: Type: text/plain, Size: 812 bytes --]

On Wed, Oct 27, 2021 at 05:13:17PM +0100, Alan Third wrote:
> 
> FWIW NSImage (on macOS) is already capable of loading an heic file, if
> we just point it to it. I thought all we needed to do is add heic to
> ns_can_use_native_image_api in nsimage.m and then load an image with
> the type of "heic" or whatever, but it doesn't work and I'm not sure
> what else I need to do. Probably define heic as a type elsewhere.

Patch attached. I'm not entirely sure this won't break anything, so
testing on a platform that already supports heif files would probably
be a good idea.

It doesn't support any of the interesting features of heif, for
example it doesn't allow you to view multiple images (like an animated
gif), but I have a suspicion the IM/GM code won't support that anyway,
so no great loss.
-- 
Alan Third

[-- Attachment #2: 0001-Add-native-HEIC-support-on-macOS-bug-51381.patch --]
[-- Type: text/plain, Size: 2751 bytes --]

From b12846cadfa052e222a7b026868e66a5a897a65a Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Fri, 26 Nov 2021 12:54:07 +0000
Subject: [PATCH] Add native HEIC support on macOS (bug#51381)

* lisp/image.el (image-type-header-regexps):
(image-type-file-name-regexps):
(image-type-auto-detectable): Add auto-detect code for heic.
* src/image.c (syms_of_image): Add heic as an image type under NS.
* src/nsimage.m (ns_can_use_native_image_api): Add heic to list of
possible image types in the native image support lookup.
---
 lisp/image.el | 7 ++++---
 src/image.c   | 5 +++++
 src/nsimage.m | 2 ++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/lisp/image.el b/lisp/image.el
index edbf6c54df..1321560575 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -56,7 +56,7 @@ image-type-header-regexps
 		"\\(?:!DOCTYPE[ \t\r\n]+[^>]*>[ \t\r\n]*<[ \t\r\n]*" comment-re "*\\)?"
 		"[Ss][Vv][Gg]"))
      . svg)
-    )
+    ("\\`....ftyp\\(heic\\|heix\\|hevc\\|heim\\|heis\\|hevm\\|hevs\\|mif1\\|msf1\\)" . heic))
   "Alist of (REGEXP . IMAGE-TYPE) pairs used to auto-detect image types.
 When the first bytes of an image file match REGEXP, it is assumed to
 be of image type IMAGE-TYPE if IMAGE-TYPE is a symbol.  If not a symbol,
@@ -76,7 +76,7 @@ image-type-file-name-regexps
     ("\\.ps\\'" . postscript)
     ("\\.tiff?\\'" . tiff)
     ("\\.svgz?\\'" . svg)
-    )
+    ("\\.hei[cf]s?\\'" . heic))
   "Alist of (REGEXP . IMAGE-TYPE) pairs used to identify image files.
 When the name of an image file match REGEXP, it is assumed to
 be of image type IMAGE-TYPE.")
@@ -95,7 +95,8 @@ image-type-auto-detectable
     (tiff . maybe)
     (svg . maybe)
     (webp . maybe)
-    (postscript . nil))
+    (postscript . nil)
+    (heic . maybe))
   "Alist of (IMAGE-TYPE . AUTODETECT) pairs used to auto-detect image files.
 \(See `image-type-auto-detected-p').
 
diff --git a/src/image.c b/src/image.c
index f2597f529d..e94a22caf7 100644
--- a/src/image.c
+++ b/src/image.c
@@ -11320,6 +11320,11 @@ syms_of_image (void)
 #endif /* HAVE_NTGUI  */
 #endif /* HAVE_RSVG  */
 
+#ifdef HAVE_NS
+  DEFSYM (Qheic, "heic");
+  add_image_type (Qheic);
+#endif
+
 #if HAVE_NATIVE_IMAGE_API
   DEFSYM (Qnative_image, "native-image");
 # ifdef HAVE_NTGUI
diff --git a/src/nsimage.m b/src/nsimage.m
index dd2bb3b0d7..98efc9c6c0 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -76,6 +76,8 @@ Updated by Christian Limpach (chris@nice.ch)
     imageType = @"public.tiff";
   else if (EQ (type, Qsvg))
     imageType = @"public.svg-image";
+  else if (EQ (type, Qheic))
+    imageType = @"public.heic";
 
   /* NSImage also supports a host of other types such as PDF and BMP,
      but we don't yet support these in image.c.  */
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-11-26 13:02             ` Alan Third
@ 2021-11-26 14:08               ` Lars Ingebrigtsen
  2021-12-22 20:53               ` Alan Third
  1 sibling, 0 replies; 37+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-26 14:08 UTC (permalink / raw)
  To: Alan Third; +Cc: Glenn Morris, Stefan Kangas, 51381

Alan Third <alan@idiocy.org> writes:

> Patch attached. I'm not entirely sure this won't break anything, so
> testing on a platform that already supports heif files would probably
> be a good idea.

Works fine for me on my M1 Apple laptop.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-11-26 13:02             ` Alan Third
  2021-11-26 14:08               ` Lars Ingebrigtsen
@ 2021-12-22 20:53               ` Alan Third
  2021-12-25 16:20                 ` Stefan Kangas
  1 sibling, 1 reply; 37+ messages in thread
From: Alan Third @ 2021-12-22 20:53 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Glenn Morris, Stefan Kangas, 51381

On Fri, Nov 26, 2021 at 01:02:28PM +0000, Alan Third wrote:
> On Wed, Oct 27, 2021 at 05:13:17PM +0100, Alan Third wrote:
> > 
> > FWIW NSImage (on macOS) is already capable of loading an heic file, if
> > we just point it to it. I thought all we needed to do is add heic to
> > ns_can_use_native_image_api in nsimage.m and then load an image with
> > the type of "heic" or whatever, but it doesn't work and I'm not sure
> > what else I need to do. Probably define heic as a type elsewhere.
> 
> Patch attached. I'm not entirely sure this won't break anything, so
> testing on a platform that already supports heif files would probably
> be a good idea.
> 
> It doesn't support any of the interesting features of heif, for
> example it doesn't allow you to view multiple images (like an animated
> gif), but I have a suspicion the IM/GM code won't support that anyway,
> so no great loss.

Since nobody complained I've pushed this to master.
-- 
Alan Third





^ permalink raw reply	[flat|nested] 37+ messages in thread

* bug#51381: HEIF image format support
  2021-12-22 20:53               ` Alan Third
@ 2021-12-25 16:20                 ` Stefan Kangas
  0 siblings, 0 replies; 37+ messages in thread
From: Stefan Kangas @ 2021-12-25 16:20 UTC (permalink / raw)
  To: Alan Third, Lars Ingebrigtsen, Glenn Morris, 51381-done

Alan Third <alan@idiocy.org> writes:

>> Patch attached. I'm not entirely sure this won't break anything, so
>> testing on a platform that already supports heif files would probably
>> be a good idea.
>>
>> It doesn't support any of the interesting features of heif, for
>> example it doesn't allow you to view multiple images (like an animated
>> gif), but I have a suspicion the IM/GM code won't support that anyway,
>> so no great loss.
>
> Since nobody complained I've pushed this to master.

Thanks.  I guess there is nothing more to do here, so I'm closing this
bug.





^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2021-12-25 16:20 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-25  3:38 bug#51381: HEIF image format support Stefan Kangas
2021-10-25  4:05 ` YAMAMOTO Mitsuharu
2021-10-25  8:50   ` YAMAMOTO Mitsuharu
2021-10-25 15:22 ` Lars Ingebrigtsen
2021-10-25 15:34   ` Stefan Kangas
2021-10-25 15:46     ` Lars Ingebrigtsen
2021-10-25 19:37       ` Stefan Kangas
2021-10-25 19:39         ` Lars Ingebrigtsen
2021-10-28 21:00           ` Stefan Kangas
2021-10-29  5:27             ` Eli Zaretskii
2021-10-29 12:35               ` Lars Ingebrigtsen
2021-10-29 13:08                 ` Stefan Kangas
2021-10-29 13:19                   ` Glenn Morris
2021-10-30 16:21                     ` Stefan Kangas
2021-10-29 13:28                 ` Eli Zaretskii
2021-10-29 13:37                   ` Lars Ingebrigtsen
2021-10-29 13:54                     ` Eli Zaretskii
2021-10-29 14:06                       ` Lars Ingebrigtsen
2021-10-29 14:13                         ` Eli Zaretskii
2021-10-29 14:15                           ` Lars Ingebrigtsen
2021-10-29 14:10                     ` Stefan Kangas
2021-10-30 16:37           ` Stefan Kangas
2021-10-25 21:36   ` Glenn Morris
2021-10-25 21:43     ` Lars Ingebrigtsen
2021-10-26 10:15       ` Alan Third
2021-10-27 13:06         ` Lars Ingebrigtsen
2021-10-27 16:13           ` Alan Third
2021-10-27 16:25             ` Lars Ingebrigtsen
2021-10-27 19:14               ` Stefan Kangas
2021-10-28 21:14                 ` Lars Ingebrigtsen
2021-10-28 22:18                   ` Stefan Kangas
2021-10-29 12:34                     ` Lars Ingebrigtsen
2021-10-29 13:08                       ` Stefan Kangas
2021-11-26 13:02             ` Alan Third
2021-11-26 14:08               ` Lars Ingebrigtsen
2021-12-22 20:53               ` Alan Third
2021-12-25 16:20                 ` Stefan Kangas

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.