Auto Lossless Rotation of All Images in Folder

Discuss and share scripts and script files...
Drasden
Posts: 16
Joined: 26 Nov 2011 14:43

Auto Lossless Rotation of All Images in Folder

Post by Drasden »

Automatic Lossless Rotation of All Images in Current Folder & Refresh Image Cache.
[Using JPEG Lossless Rotator]

I know that XYplorer has commands for lossless rotation. But I am unaware of commands for automatically deciding the correct orientation, or doing this for an entire folder. (I could be wrong.)

This is a simple script I use to do it. Hope this helps save someone some time.

Download the version of JPEG Lossless Rotator that you need.
(32/64/portable versions available) at
http://annystudio.com/software/jpeglosslessrotator/

If it cannot rotate the image losslessly, the app will prompt you (unless you decide to suppress the warning messages).

To run it from your catalog the 'Action on click' should be the 'go to location' option.

Code: Select all

"Lossless Automatic Rotation + Refresh Img cache"
  ::run """C:\Path to your exe\jpegr.exe"" /auto <curpath_dos>\";  //Option, adding /s will suppress warning messages
  #501;   //optional, Refresh the image cache for good measure.
If a there is a previous that covers the same topic, just let me know and I'll remove this post.

Cheers.

binocular222
Posts: 1421
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: Auto Lossless Rotation of All Images in Folder

Post by binocular222 »

Cannot auto rotate individual file. This not works

Code: Select all

run """E:\Media\JPEGLossless rotate\x64\jpegr.exe"" /auto ""<curitem>"""
because jpegr.exe expect the /auto switch to come with a folder instead of a file.
I need something to auto rotate individual file, so that I can assign to Portable File Association
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

Stef123

Re: Auto Lossless Rotation of All Images in Folder

Post by Stef123 »

Maybe I don't really grasp the question to start with. Are we talking EXIF-orientation tags? Which may be off kilter if the camera was held at weird angles in upside down positions. But then an auto-option wouldn't help, either :veryconfused:

If "image cache" refers to thumbnail cache, doesn't XY's config > thumbnails > "auto-rotate thumbnails" take care of this?

binocular222
Posts: 1421
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: Auto Lossless Rotation of All Images in Folder

Post by binocular222 »

It's EXIF-orientation tags. Not all software can detect and display correctly, thus I need PFA to edit the file before passing to the other "stupid" programs
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

Stef123

Re: Auto Lossless Rotation of All Images in Folder

Post by Stef123 »

I am getting closer, so is this not about "correcting" an orientation-tag, it's about missing or unreadable orientation tags? About a way to make certain pics fool-proof for stupid software? But how would you tell the software which way to turn? Other than re-painting the pic into standard landscape size?

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Auto Lossless Rotation of All Images in Folder

Post by PeterH »

Stef123 wrote:I am getting closer, so is this not about "correcting" an orientation-tag, it's about missing or unreadable orientation tags? About a way to make certain pics fool-proof for stupid software? But how would you tell the software which way to turn? Other than re-painting the pic into standard landscape size?
If I got it right: no!

It's about programs silly enough to ignore the tag.
You either can have a file in landscape orientation, but with orientation=portrait: then a program should turn it appropriate. But some don't :(
To help you can (lossless) turn the physical data of such a file to portrait (and maybe reset orientation tag?) - then programs ignoring the flag will show it correct.

(Had this problem on showing .jpg from stick on a TV :cry: )

Stef123

Re: Auto Lossless Rotation of All Images in Folder

Post by Stef123 »

Thanks Peter,
for taking the time to explain. You're right, I was on the wrong track. After reading more about the program it dawns on me that this is indeed about "repainting" pixels, well, maybe not repainting in a strict sense - that would hardly pass as lossless - but rather "re-arranging" pixels. Interesting approach. Also thanks to Drasden for bringing it up.

Would have never guessed why this were necessary, with so many good viewers out there that handle EXIF orientation. However, your TV example brings it home nicely.

@bino
sorry for the detour. I cannot answer your question about the run-command for a single file.

binocular222
Posts: 1421
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: Auto Lossless Rotation of All Images in Folder

Post by binocular222 »

Anyone known a good portable rotator?
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Auto Lossless Rotation of All Images in Folder

Post by PeterH »

binocular222 wrote:Anyone known a good portable rotator?
In general: XYplorer :biggrin:

via rotate scripting command.

binocular222
Posts: 1421
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: Auto Lossless Rotation of All Images in Folder

Post by binocular222 »

XY cannot read EXIF to make correct auto-rotate
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

admin
Site Admin
Posts: 65561
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Auto Lossless Rotation of All Images in Folder

Post by admin »

Of course it can, it does it all the time when displaying rotated JPEGs. :whistle:

binocular222
Posts: 1421
Joined: 04 Nov 2008 05:35
Location: Win11, Win10, 100% Scaling

Re: Auto Lossless Rotation of All Images in Folder

Post by binocular222 »

Code: Select all

rotate [mode=90|180|270|h|v], [jpgfile_src], [jpgfile_trg], [only_if_lossless=0|1], [flags]
No "auto" mode?
I'm a casual coder using AHK language. All of my xys scripts:
http://www.xyplorer.com/xyfc/viewtopic. ... 243#p82488

Stef123

Re: Auto Lossless Rotation of All Images in Folder

Post by Stef123 »

Don, could you point to resources that explain the rationale behind XY's rotating feature? I am still trying to come to grips with this whole rotating business that does NOT rely on simply changing the orientation tag. Which of course, could be out of whack if there's a mismatch between physical pixel orientation and exif-tag. I don't see how this could be helped by an "auto-" fixing routine :ugeek:

Btw, no SC flag for the timestamp - whether to leave it alone or change it.

admin
Site Admin
Posts: 65561
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Auto Lossless Rotation of All Images in Folder

Post by admin »

It's an idea for later.

PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Auto Lossless Rotation of All Images in Folder

Post by PeterH »

Stef123 wrote:Don, could you point to resources that explain the rationale behind XY's rotating feature? I am still trying to come to grips with this whole rotating business that does NOT rely on simply changing the orientation tag. Which of course, could be out of whack if there's a mismatch between physical pixel orientation and exif-tag. I don't see how this could be helped by an "auto-" fixing routine :ugeek:
See it this way: a picture has 300*200 pixels. (Example :biggrin: ) Shown normal it is landscape, with tag portrait it *should* be roteted and shown as portrait.

Now you might copy the file reordering the pixels "row by column": make 200*300 pixels - that *is* portrait. This is what's called "lossless rotation".

(At least as I understood it - correct my if I'm wrong! :whistle: )

Post Reply