Skip to content

Commit

Permalink
Implement the correct orientation support for JPEG XL images
Browse files Browse the repository at this point in the history
We now support the correct orientation if it was specified in the format's
basic info but not in Exif (or Exif is missing). We also avoid excessive
transformation if it is specified in both the basic data and Exif.
  • Loading branch information
victoryforce authored and TurboGit committed Feb 8, 2025
1 parent 0d5dc37 commit 0619eb1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/imageio/imageio_jpegxl.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,14 @@ dt_imageio_retval_t dt_imageio_open_jpegxl(dt_image_t *img,
return DT_IMAGEIO_FILE_CORRUPTED;
}

// Orientation values in JXL basic info match Exif definitions
img->orientation = dt_image_orientation_to_flip_bits(basicinfo.orientation);

// We don't re-orient the data during decoding, this will be done later
// by darktable according to the metadata value (this value can be
// either the one obtained above or the value read from Exif data)
JxlDecoderSetKeepOrientation(decoder, JXL_TRUE);

uint32_t num_threads =
JxlResizableParallelRunnerSuggestThreads(basicinfo.xsize,
basicinfo.ysize);
Expand Down

0 comments on commit 0619eb1

Please sign in to comment.