Image rotation in stand alone image viewer

Is it possible to make the rotate button in the stand alone viewer permanently rotate an image, instead of just rotating the view you see at the time. When I've imported a bunch of pictures I use dopus rotate to rotate all the images by exif, but it doesn't get them all right, so then I run through them in the windows picture viewer (the old windows 7 one) and manually rotate those that need it. I'd like to use the dopus standalone viewer but need to change this first.

You can but since lossless JPEG rotation is not possible with all images it may not make sense to do it with just rotate left / rotate right buttons. (If you need to rotate 180 degrees, you'll apply two lossy passes instead of one.)

The image converter can be invoked from the viewer, either interactively (which is in the default menus for Opus 12) or automated (e.g. you could add buttons to rotate the file by 90, 180, 270).

OTOH, if you don't care about slight quality loss for some JPEGs then just rotate the images in the viewer and then use the Save option (ctrl-s). (Actually, it's possible that will do a lossless rotation if it can, but I'd need to check the viewer code to see if it's intelligent enough to do that. It may only be the image converter which does lossless rotation.)

Thanks for your reply.

I am not a pro photographer so can accept some loss of quality. I am a contractor who takes loads of pictures for work inspection / reporting purposes. I prefer to use lossless rotate and do so in dopus, but when rotating using the windows viewer I just accept the slight quality loss. I have never actually been able to see any difference in quality when doing this. I need to drastically reduce the quality of a picture in photoshop before quality loss becomes apparent.

I like the sound of adding the lossless rotate buttons to the dopus viewer. I am just going to see if I can figure out how you do that.

I've been working on this and I'm getting there - slowly.

I have discovered that I can edit the standalone image viewer toolbar the same way I can edit toolbars in the main dopus window. I cannot, however, find buttons for lossless rotation (90 degrees, 180, etc). I found and added the "convert image" button though, but that's not so quick.

I also discovered that hitting the numbers 123 and 0 does a rotation. Not sure if that's lossless. I discovered this when I was looking through the Keys list in the Customize dialog window.

Also, how do I add a button that opens the standalone viewer. I have managed to hack the slideshow button so it does this without starting a slideshow or being full screen (which is what I want) but there must be a button to open the viewer is there not.

I am sorry. I am hammering the forum with questions and you are the only person fielding them. I'm feeling like you should charge me extra when I pay for dopus 12 - to cover support costs :slight_smile:

90 degree rotation in the viewer and file at once, lossless if possible:

[Code removed. Corrected version below.]

Trying this with the current beta, there's a bug where it only works the first time due to the viewer losing track of the real file when it's replaced. We'll look at fixing that.

Re the toolbar at the top of the viewer, you can edit it like normal toolbars in Opus 12.

Correction, the 2nd line should be +90 not 90 on its own:

Show VIEWERCMD=rotate,+90

(A better way to do this in newer versions of Opus is below.)

I've added that and it works - thanks.

Is there an easier way to add buttons like this that don't seem to appear in the normal commands list, as for this I would need to have much more knowledge of the coding that dopus uses.

I am using your suggested command sequece to rotate and save an image. This:

Show VIEWERCMD=rotate,+90

It does work but with one glitch: with the image in the image viewer, the image rotates and does save, but if I advance to the next image and then back to the image I rotated and saved, the image appears as rotated twice, even though it is saved as rotated only once. It's as if the Show VIEWERCMD=rotate,+90 is acting twice and the image viewer is remembering that. If I close the image viewer and reopen, I see the image rotated/saved as expected. The problem obviously is that although these two commands together do rotate/save the file as desired, the viewer displays the image incorrectly, elminating the convenience of rotating/saving. It seems like a bug but perhaps I am not understanding what is required to resolve.

In newer versions of Opus you can do this better now:

Show VIEWERCMD=refresh

Right. Exactly. Thank you.

One more thing: Although the rotation and display works perfectly now, the file size is increasing with each rotation. What is the reason for that and can it be avoided?

Depends on the type of image.

If we're talking about JPEGs, even lossless rotation can change the file size slightly due to rejigging the way the data is stored. (If it is lossless, the size should change back if you rotate back to the original orientation.)

If it's a type of JPEG which cannot be losslessly rotated (e.g. due to the width or height not being a multiple of 8), then rotating the image data will require re-compressing it, which may increase the size because it isn't the same data that was originally compressed, and the command is also using QUALITY=100 which will produce fairly large files. (Recompressing a JPEG will also reduce the quality, since it's lossy compression being applied to something that's already gone through a lossy compression.)

ok, thanks. understood.

Remember that JPEG is always lossy. Setting the quality to a 100 doesn't make it lossless. Essentially what you get is all the negatives of lossy compression, and little to none of the benefits of actual compression - because as mentioned it actually can increase te size.

This is likely due to the fact that saving the image with lossy compression creates artifacts, so the next time you save the image with maximum quality again it actually tries to preserve these new artifacts like they're actual detail. But in most cases it's probably just the original image that was saved at a quality less than a 100 in the first place.

Personally i find that quality 95 has good compression with practically no visible loss of quality. That is even if you were to compare them side by side at 100% size it'd be hard to spot. Usually you can get away with 90 if you don't plan on re-saving again. Otherwise use PNG for lossless compression - this makes them fairly large, but it is the smallest they can be while preserving the ability to save and re-save them without any loss of quality what-so-ever. It's way smaller than TIFF, and way-way smaller than BMP anyway.

JPEG rotation is not always lossy. Sometimes it can be done without reencoding the image. (Sometimes it is lossy, of course.)

Sorry i should have quoted, the reply was to the file size increasing with QUALITY=100, not the rotation

1 Like