GNU bug report logs - #67149
30.0.50; save rotated image in image-mode

Previous Next

Package: emacs;

Reported by: Peter Münster <pm <at> a16n.net>

Date: Mon, 13 Nov 2023 14:57:01 UTC

Severity: wishlist

Found in version 30.0.50

Full log


View this message in rfc822 format

From: Peter Münster <pm <at> a16n.net>
To: 67149 <at> debbugs.gnu.org
Subject: bug#67149: 30.0.50; save rotated image in image-mode
Date: Thu, 21 Mar 2024 19:12:55 +0100
[Message part 1 (text/plain, inline)]
On Mon, Nov 13 2023, Peter Münster wrote:

> This is a feature request. I would like to rotate an image by 90° and
> save the result without using image-dired. It seems, that "i r" and "s
> r" change only the display...
>
> Could somebody add this feature please?

Hi,

Here is my solution:

--8<---------------cut here---------------start------------->8---
(defun pm/img-rotate (dir)
  "Rotate active image to direction DIR."
  (call-process (concat "rot" dir ".sh") nil "*Messages*" nil (buffer-file-name))
  (revert-buffer nil t))

(defun pm/img-rotate-left ()
  "Rotate active image to the left."
  (interactive)
  (pm/img-rotate "left"))

(defun pm/img-rotate-right ()
  "Rotate active image to the right."
  (interactive)
  (pm/img-rotate "right"))

(define-key image-map "l" 'pm/img-rotate-left)
(define-key image-map "r" 'pm/img-rotate-right)
--8<---------------cut here---------------end--------------->8---

rotleft.sh and rotright.sh are using jpegtran for the rotation.

But there is one problem, that bothers me: When there is something like
"Orientation: Rotate 180" in the Exif metadata, the display is not
updated after the rotation.

My workaround: "exiftool -Orientation= image.jpg" and then restart Emacs.

What would be a cleaner solution please?

TIA for any help,
-- 
           Peter
[signature.asc (application/pgp-signature, inline)]

This bug report was last modified 1 year and 142 days ago.

Previous Next


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