JPEG XL Orientation

*** Please try to reproduce your bug and confirm the bug fix. ***

Moderators: helmut, XnTriq, xnview, Dreamer

Post Reply
bananakid
Posts: 4
Joined: Mon Apr 20, 2020 12:00 pm

JPEG XL Orientation

Post by bananakid »

Environment: Windows 10, version 21H2
XnView MP: 1.7.1, 1.8.3

I take a picture with my DSLR camera while holding it it "portrait" mode (no settings touched on the camera side). I then import the JPEG file to my computer. There I convert my JPEG to JPEG XL in two different ways, both using the most recent reference implementation binaries of JPEG XL provided by one of the developers (I open Command Prompt in the location of JPEG file before I run the command, I also set Path to JPEG XL binaries in computer's Environment Variables before that):
1) lossless recompression — for /r . %f in (*.jpg) do cjxl -j 1 -d 0 -e 10 --brotli_effort=11 "%~f" "%~dpnf._100.jxl"
2) lossly 90% compression — for /r . %f in (*.jpg) do cjxl -j 0 -m 0 -d 1 -e 10 --brotli_effort=11 --num_threads=14 "%~f" "%~dpnf._90.jxl"

This is the result I get in XnView MP's browser window if I have Settings → General → Auto-rotate images according to EXIF orientation turned on:
Image

This is the result I get in XnView MP's browser window if I have Settings → General → Auto-rotate images according to EXIF orientation turned off:
Image

Here's the EXIF data of JPEG.

Here's EXIF data of JPEG XL (both lossless and lossy are the same).

When viewing any of JXL images I get the same orientation as in preview/thumbnail image displayed in browser. That results in wrong orientation of JXL compared to other formats, i.e. JPG: if the auto-orientation is on, the JXL get's rotated-orientated twice in browser/viewer of XnView MP (i.e. 540° instead of 270°), and if auto-orientation is off, the JXL still gets rotated-orientated (i.e. 270° instead of 0°). This makes it challenging to work with folders that contain mixed file types, i.e. JXL+JPG+PNG.

I find current behavior to be quite confusing because I have to constantly switch auto-rotation on and off to manage photos library. I've tried to figure out why that happens but came across only a convoluted explanation in JPEG XL's source code, a brief mention of the kind of sort of the same issue in GitHub comments of the other project and a discussion at Adobe forums that lead to bugfix of Adobe's software.

P.S. I'm sorry this report doesn't follow bug report template closely. I hope this won't make my report obsolete.
Last edited by bananakid on Sun Dec 01, 2024 1:00 pm, edited 1 time in total.
User avatar
xnview
Author of XnView
Posts: 46328
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: XnView MP 1.8.3 JPEG XL Orientation

Post by xnview »

Pierre.
User avatar
xnview
Author of XnView
Posts: 46328
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: JPEG XL Orientation

Post by xnview »

This problem is supposed to be fixed in XnView MP 1.8.4. Please check and confirm the bug fix here.
Pierre.
golemus
Posts: 75
Joined: Mon Dec 23, 2024 8:35 am

Re: JPEG XL Orientation

Post by golemus »

I am not sure what was issue here as I don't see the images but most recent XNMP version ignores Jpeg XL exif orientation value

I use these scripts to rotate/change orientation:

0:
exiftool -n -orientation=1 -overwrite_original "%INPUTFILE%"

90:
exiftool -n -orientation=6 -overwrite_original "%INPUTFILE%"

180:
exiftool -n -orientation=3 -overwrite_original "%INPUTFILE%"

270:
exiftool -n -orientation=8 -overwrite_original "%INPUTFILE%"


MS Photos respects exif orientation value.

To be fair there are many apps out there that do not yet respect it. Anyway it makes life a bit more complex with JXL images.
User avatar
xnview
Author of XnView
Posts: 46328
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: JPEG XL Orientation

Post by xnview »

golemus wrote: Tue Jul 01, 2025 5:50 am I am not sure what was issue here as I don't see the images but most recent XNMP version ignores Jpeg XL exif orientation value
please send us some sample files
Pierre.
golemus
Posts: 75
Joined: Mon Dec 23, 2024 8:35 am

Re: JPEG XL Orientation

Post by golemus »

xnview wrote: Tue Jul 01, 2025 6:31 am
golemus wrote: Tue Jul 01, 2025 5:50 am I am not sure what was issue here as I don't see the images but most recent XNMP version ignores Jpeg XL exif orientation value
please send us some sample files
Here you go:

https://1drv.ms/u/c/9ae6b4fc77ec78a7/EW ... g?e=Ghk41q
WinnieW
Posts: 35
Joined: Thu Jan 17, 2013 2:28 pm

Re: JPEG XL Orientation

Post by WinnieW »

The JPEG XL format has its own flag for image orientation. libJXL ignores the image orientation information from the EXIF tag.

Source:
https://github.com/libjxl/libjxl/blob/f ... verview.md
under section Metadata versus Image Data.

I don't know how to edit the orientation flag of a JXL image.
Post Reply