GNU bug report logs - #10758
thumbs and image-dired to use built-in ImageMagick

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Wed, 8 Feb 2012 04:54:02 UTC

Severity: wishlist

Found in version 24.0.93

Fixed in version 29.1

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10758 in the body.
You can then email your comments to 10758 AT debbugs.gnu.org in the normal way.

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

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


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#10758; Package emacs. (Wed, 08 Feb 2012 04:54:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: thumbs and image-dired to use built-in ImageMagick
Date: Tue, 07 Feb 2012 23:52:12 -0500
Package: emacs
Version: 24.0.93
Severity: wishlist

thumbs.el and image-dired.el both rely on using external ImageMagick
utilities to resize/rotate images.

If Emacs was compiled with ImageMagick support, then images of
type imagemagick can be resized and rotated internally (see
image-transform-*). These modes should use the internal support if
it exists.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10758; Package emacs. (Fri, 01 Nov 2019 22:49:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 10758 <at> debbugs.gnu.org
Subject: Re: thumbs and image-dired to use built-in ImageMagick
Date: Fri, 01 Nov 2019 23:47:59 +0100
Glenn Morris <rgm <at> gnu.org> writes:

> Package: emacs
> Version: 24.0.93
> Severity: wishlist
>
> thumbs.el and image-dired.el both rely on using external ImageMagick
> utilities to resize/rotate images.
>
> If Emacs was compiled with ImageMagick support, then images of
> type imagemagick can be resized and rotated internally (see
> image-transform-*). These modes should use the internal support if
> it exists.

So now that we have native image rotation and ImageMagick is on its
way to become deprecated, I assume that this bug should be taken to
mean that we want to use the built-in support here instead.

Best regards,
Stefan Kangas




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10758; Package emacs. (Sat, 23 Oct 2021 06:58:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 10758 <at> debbugs.gnu.org
Subject: Re: bug#10758: thumbs and image-dired to use built-in ImageMagick
Date: Fri, 22 Oct 2021 23:57:42 -0700
Stefan Kangas <stefan <at> marxist.se> writes:

> Glenn Morris <rgm <at> gnu.org> writes:
>
>> Package: emacs
>> Version: 24.0.93
>> Severity: wishlist
>>
>> thumbs.el and image-dired.el both rely on using external ImageMagick
>> utilities to resize/rotate images.
>>
>> If Emacs was compiled with ImageMagick support, then images of
>> type imagemagick can be resized and rotated internally (see
>> image-transform-*). These modes should use the internal support if
>> it exists.
>
> So now that we have native image rotation and ImageMagick is on its
> way to become deprecated, I assume that this bug should be taken to
> mean that we want to use the built-in support here instead.

Hmm, looking closer at this, both thumbs.el and image-dired.el modifies
the actual image file.  This is something that our built-in support
can't do, as we only have support for reading images.

However, the ImageMagick library has these capabilities.  Given that we
no longer compile with ImageMagick by default, I don't think this
request makes any sense as it stands.  Perhaps we could implement the
in-memory rotation in addition to the modifying one that we have now,
but this is unlikely to be very useful.  If I rotate an image in an
image viewer, it is almost certainly because I want to update the file;
at least this is always the case in my use.

Jpeg images can of course be losslessly rotated by just modifying the
exif data, so implementing built-in support for rotating jpeg images
seems quite doable.  However, we would still not be able to drop the
external imagemagick dependency, because we would then also lose the
capability to rotate other image formats.

So perhaps this feature request is relevant anymore.  WDYT?




Added tag(s) moreinfo. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Sat, 23 Oct 2021 06:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10758; Package emacs. (Sun, 24 Oct 2021 09:15:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 10758 <at> debbugs.gnu.org, Mathias Dahl <mathias.rem0veth1s.dahl <at> gmail.com>
Subject: Re: bug#10758: thumbs and image-dired to use built-in ImageMagick
Date: Sun, 24 Oct 2021 02:14:32 -0700
Stefan Kangas <stefan <at> marxist.se> writes:

> So perhaps this feature request is relevant anymore.  WDYT?

I now see that Glenn mentioned resizing as well, where using the
built-in image scaling seems very relevant.  We currently jump through
some unnecessary hoops in `image-dired-display-image' when we could just
resize the image in memory.

Is there any reason why `image-dired-display-image-mode' doesn't just
inherit `image-mode'?  That would avoid code duplication and also allow
us to immediately benefit from any improvements to `image-mode'.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10758; Package emacs. (Sun, 24 Oct 2021 09:46:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 10758 <at> debbugs.gnu.org, Mathias Dahl <mathias.dahl <at> gmail.com>
Subject: Re: bug#10758: thumbs and image-dired to use built-in ImageMagick
Date: Sun, 24 Oct 2021 02:45:26 -0700
Stefan Kangas <stefan <at> marxist.se> writes:

> Stefan Kangas <stefan <at> marxist.se> writes:
>
>> So perhaps this feature request is relevant anymore.  WDYT?
>
> I now see that Glenn mentioned resizing as well, where using the
> built-in image scaling seems very relevant.  We currently jump through
> some unnecessary hoops in `image-dired-display-image' when we could just
> resize the image in memory.
>
> Is there any reason why `image-dired-display-image-mode' doesn't just
> inherit `image-mode'?  That would avoid code duplication and also allow
> us to immediately benefit from any improvements to `image-mode'.

Resending to include Mathias Dahl in the conversation.

(I missed removing ".rem0veth1s" from his listed email address.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10758; Package emacs. (Mon, 25 Oct 2021 19:03:02 GMT) Full text and rfc822 format available.

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

From: Mathias Dahl <mathias.dahl <at> gmail.com>
To: Stefan Kangas <stefan <at> marxist.se>
Cc: Glenn Morris <rgm <at> gnu.org>, 10758 <at> debbugs.gnu.org
Subject: Re: bug#10758: thumbs and image-dired to use built-in ImageMagick
Date: Mon, 25 Oct 2021 21:02:42 +0200
[Message part 1 (text/plain, inline)]
On Sun, Oct 24, 2021 at 11:45 AM Stefan Kangas <stefan <at> marxist.se> wrote:

> Stefan Kangas <stefan <at> marxist.se> writes:
>
> > Stefan Kangas <stefan <at> marxist.se> writes:
> >
> >> So perhaps this feature request is relevant anymore.  WDYT?
> >
> > I now see that Glenn mentioned resizing as well, where using the
> > built-in image scaling seems very relevant.  We currently jump through
> > some unnecessary hoops in `image-dired-display-image' when we could just
> > resize the image in memory.
> >
> > Is there any reason why `image-dired-display-image-mode' doesn't just
> > inherit `image-mode'?  That would avoid code duplication and also allow
> > us to immediately benefit from any improvements to `image-mode'.


Hi, sorry for coming late to the party.

I cannot remember any good reason for not inheriting from `image-mode', but
I opened image-dired.el now and found this:

(defvar image-dired-display-image-mode-map
  (let ((map (make-sparse-keymap)))
    ;; `image-mode-map' has bindings that do not make sense in image-dired
    ;; (set-keymap-parent map image-mode-map)
    (define-key map "f" 'image-dired-display-current-image-full)
    (define-key map "s" 'image-dired-display-current-image-sized)
    (define-key map "g" nil)

    ;; Useful bindings from `image-mode-map'
    (define-key map [remap forward-char] 'image-forward-hscroll)
    (define-key map [remap backward-char] 'image-backward-hscroll)
...

It seems I knew about `image-mode' but perhaps it never crossed my mind
to inherit from it. 16 years later, my memory fails me...

At any rate I have nothing against it, if someone wants to give it a try.

/Mathias
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10758; Package emacs. (Mon, 25 Oct 2021 19:38:01 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Mathias Dahl <mathias.dahl <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 10758 <at> debbugs.gnu.org
Subject: Re: bug#10758: thumbs and image-dired to use built-in ImageMagick
Date: Mon, 25 Oct 2021 12:37:51 -0700
Mathias Dahl <mathias.dahl <at> gmail.com> writes:

> It seems I knew about `image-mode' but perhaps it never crossed my mind
> to inherit from it. 16 years later, my memory fails me...
>
> At any rate I have nothing against it, if someone wants to give it a try.

Thank you, that is useful information.  I intend to look into this.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10758; Package emacs. (Wed, 27 Oct 2021 22:15:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 10758 <at> debbugs.gnu.org
Subject: Re: bug#10758: thumbs and image-dired to use built-in ImageMagick
Date: Wed, 27 Oct 2021 15:13:58 -0700
Stefan Kangas <stefan <at> marxist.se> writes:

>> Glenn Morris <rgm <at> gnu.org> writes:
>>
>>> thumbs.el and image-dired.el both rely on using external ImageMagick
>>> utilities to resize/rotate images.
>>>
>>> If Emacs was compiled with ImageMagick support, then images of
>>> type imagemagick can be resized and rotated internally (see
>>> image-transform-*). These modes should use the internal support if
>>> it exists.
>>
>> So now that we have native image rotation and ImageMagick is on its
>> way to become deprecated, I assume that this bug should be taken to
>> mean that we want to use the built-in support here instead.

I fixed this in `image-dired' (see separate patch).

I guess we could rebase thumbs.el to also use the built-in image viewing
support, but I took a look and this external conversion seems built into
the foundation of how that library works.  So this looks to me like it
would amount to a rewrite of thumbs.el.  I could be wrong of course, but
that was my conclusion after poking at it for an hour or so.

Furthermore, at this point, image-dired.el is by far the more powerful
package, and it seems better implemented overall.  Although it borrows
heavily from thumbs.el (or at least it used to), thumbs.el seems fully
redundant these days.  However, it has some features that image-dired.el
does not, especially when it comes to modifying images.

So rather than attempting a rewrite of thumbs.el, the better solution
seems to me to add any important missing features from thumbs.el to
image-dired.el, and then obsoleting the former (not necessarily in that
order, but either way is fine to me).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10758; Package emacs. (Wed, 27 Oct 2021 22:15:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Mathias Dahl <mathias.dahl <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 10758 <at> debbugs.gnu.org
Subject: Re: bug#10758: thumbs and image-dired to use built-in ImageMagick
Date: Wed, 27 Oct 2021 15:14:09 -0700
[Message part 1 (text/plain, inline)]
Stefan Kangas <stefan <at> marxist.se> writes:

> Mathias Dahl <mathias.dahl <at> gmail.com> writes:
>
>> It seems I knew about `image-mode' but perhaps it never crossed my mind
>> to inherit from it. 16 years later, my memory fails me...
>>
>> At any rate I have nothing against it, if someone wants to give it a try.

See the attached patch.  Unsurprisingly, this makes `image-dired' feel
quite a bit snappier, as we avoid a lot of unnecessary work.
[0001-Make-image-dired-display-image-mode-inherit-from-ima.patch (text/x-diff, attachment)]

Removed tag(s) moreinfo. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Thu, 04 Nov 2021 00:07:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10758; Package emacs. (Thu, 04 Nov 2021 01:09:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Mathias Dahl <mathias.dahl <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 10758 <at> debbugs.gnu.org
Subject: Re: bug#10758: thumbs and image-dired to use built-in ImageMagick
Date: Wed, 3 Nov 2021 18:08:25 -0700
Stefan Kangas <stefan <at> marxist.se> writes:

> Stefan Kangas <stefan <at> marxist.se> writes:
>
>> Mathias Dahl <mathias.dahl <at> gmail.com> writes:
>>
>>> It seems I knew about `image-mode' but perhaps it never crossed my mind
>>> to inherit from it. 16 years later, my memory fails me...
>>>
>>> At any rate I have nothing against it, if someone wants to give it a try.
>
> See the attached patch.  Unsurprisingly, this makes `image-dired' feel
> quite a bit snappier, as we avoid a lot of unnecessary work.

No comments within a week, so I've now pushed to master as commit
73a6c8f98f with some further tweaks and a NEWS entry.

Please report here or open a new bug if you run into any issues.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10758; Package emacs. (Tue, 07 Dec 2021 22:48:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 10758 <at> debbugs.gnu.org
Subject: Re: bug#10758: thumbs and image-dired to use built-in ImageMagick
Date: Tue, 7 Dec 2021 23:46:58 +0100
close 10758 29.1
thanks

Stefan Kangas <stefan <at> marxist.se> writes:

> I fixed this in `image-dired' (see separate patch).
>
> I guess we could rebase thumbs.el to also use the built-in image viewing
> support, but I took a look and this external conversion seems built into
> the foundation of how that library works.  So this looks to me like it
> would amount to a rewrite of thumbs.el.  I could be wrong of course, but
> that was my conclusion after poking at it for an hour or so.
>
> Furthermore, at this point, image-dired.el is by far the more powerful
> package, and it seems better implemented overall.  Although it borrows
> heavily from thumbs.el (or at least it used to), thumbs.el seems fully
> redundant these days.  However, it has some features that image-dired.el
> does not, especially when it comes to modifying images.
>
> So rather than attempting a rewrite of thumbs.el, the better solution
> seems to me to add any important missing features from thumbs.el to
> image-dired.el, and then obsoleting the former (not necessarily in that
> order, but either way is fine to me).

No further comments within 6 weeks, so I think we can say that this bug
is resolved for now, and we can look into making thumbs.el obsolete
later.

I'm therefore closing this bug as fixed for image-dired.el.  If that
conclusion is incorrect, please re-open.




bug marked as fixed in version 29.1, send any further explanations to 10758 <at> debbugs.gnu.org and Glenn Morris <rgm <at> gnu.org> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Tue, 07 Dec 2021 22:48:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 05 Jan 2022 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 110 days ago.

Previous Next


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