Rotate & Save Image In One Click

I searched this forum for a solution but found no recent posts that describe how to rotate images and save them in a single click, either from within viewer panel or the right-context lister menu. I use Windows 10 and added this capability via this registery hack. Although this works in File Explorer (see image), the entries do not appear on the Directory Opus context menu.
2020-07-22 20_14_21-Window
Ideally, it would be helpful if we could select multiple thumbnails and rotate/save them using the right click context menu.

If you want to rotate a file from the file display (e.g. via the right-click menu, or a lister toolbar or lister hotkey), use this as the command:

Image ROTATE=90 HERE REPLACE QUALITY=75

If you want to rotate the file in the image viewer (i.e. rotate the actual file on disk, and also update the orientation in the image viewer), put this on the viewer toolbar, or viewer context menu, or a viewer hotkey:

Image ROTATE=90 HERE REPLACE QUALITY=75
Show VIEWERCMD=refresh

(The first line is the same in both commands. You can change the QUALITY value if you want; it's only used when rotating JPEGs, although they will usually be rotated losslessly anyway, unless they have unusual dimensions etc.)

Commands are from this post, which is from 2017 but still correct:

Leo, thank you once again for your kind and informative reply.
I have successfully implemented the commands as suggested.
Here is what I did in case future visitors seeing this post want to do the same thing.

From Lister Menu: Settings->Customize Toolbar->Commands
In the Commands listbox Click Add new User Command & paste in recommended code.

  • I modified the recommendations to @nodeselect (this allows multiple selected images to be rotated at the same time
  • I also changed set quality=100
    I completed the other items in the Command Editor and clicked ok.
    I then dragged the command to the Lister toolbar.
1 Like

FWIW, you can create commands directly on to a toolbar, without creating a User Command first.

User Commands are useful if you want the same thing in more than one place, without duplicating the definition of the command, but not if you only want the command in one place. In general, they are not used/needed that often.

The command will handle multiple files without @nodeselect. Adding @nodeselect just means the files will remain selected after they have all been rotated.

(You may still want @nodeselect, so you can rotate all the images a second time without re-selecting them, of course. I'm just clarifying what it does.)

If you're using the command the lister/file display toolbar, then you probably don't want the Show VIEWERCMD=refresh line to be that. That line only makes sense in the viewer. (It tells the viewer to reload the current file.)

As an aside, there are already rotate buttons on the default Images toolbar that comes with Opus, which, by default, is turned on when you switch into thumbnails mode. (I forgot about that yesterday.)

1 Like

Hey there!
I just added some rotate buttons to my toolbar and I used this script (Image ROTATE=90 HERE REPLACE QUALITY=75). I find that the focus has moved after I execute the command. I'd like to keep the focus on the file after the command. This would enable me to perform two rotate commands quickly without having to click on the file again-

Use @nodeselect to stop buttons deselecting the files they work on:

@nodeselect
Image ROTATE=90 HERE REPLACE QUALITY=75

(If the button editor is in single-line mode, click Advanced to go into multi-line mode.)

You can also turn off Preferences / File Operations / Options / Deselect files used in functions to make buttons not deselect by default, but @nodeselect lets you do it on a per-button basis.

1 Like

Thanks Leo! Works perfect-

Here's a couple of arrow rotation icons for anyone who is looking for one. I made these quickly because I couldn't find similar arrows in the default icon set from DOpus.
Left arrow (Inkscape)
Right arrow (Inkscape)

There're icons for rotateleft and -right included in default icon set.

image