bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#67149: 30.0.50; save rotated image in image-mode


From: Peter Münster
Subject: bug#67149: 30.0.50; save rotated image in image-mode
Date: Thu, 21 Mar 2024 19:12:55 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

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

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]