@@ -177,7 +177,8 @@ __strong void(^cleanupBlock)(void) __attribute__((cleanup(sd_executeCleanupBlock
177177 JxlBasicInfo info;
178178 status = JxlDecoderGetBasicInfo (dec, &info);
179179 if (status != JXL_DEC_SUCCESS) return nil ;
180- CGImagePropertyOrientation exifOrientation = (CGImagePropertyOrientation)info.orientation ;
180+ // By defaults, libjxl applys transform for orientation, unless we call `JxlDecoderSetKeepOrientation`
181+ // CGImagePropertyOrientation exifOrientation = (CGImagePropertyOrientation)info.orientation;
181182
182183 // colorspace
183184 size_t profileSize;
@@ -212,10 +213,9 @@ __strong void(^cleanupBlock)(void) __attribute__((cleanup(sd_executeCleanupBlock
212213 return nil ;
213214 }
214215#if SD_MAC
215- UIImage *image = [[UIImage alloc ] initWithCGImage: imageRef scale: scale orientation: exifOrientation ];
216+ UIImage *image = [[UIImage alloc ] initWithCGImage: imageRef scale: scale orientation: kCGImagePropertyOrientationUp ];
216217#else
217- UIImageOrientation orientation = [SDImageCoderHelper imageOrientationFromEXIFOrientation: exifOrientation];
218- UIImage *image = [[UIImage alloc ] initWithCGImage: imageRef scale: scale orientation: orientation];
218+ UIImage *image = [[UIImage alloc ] initWithCGImage: imageRef scale: scale orientation: UIImageOrientationUp];
219219#endif
220220 CGImageRelease (imageRef);
221221
@@ -237,10 +237,9 @@ __strong void(^cleanupBlock)(void) __attribute__((cleanup(sd_executeCleanupBlock
237237 CGImageRef imageRef = [self sd_createJXLImageWithDec: dec info: info colorSpace: colorSpaceRef thumbnailSize: thumbnailSize preserveAspectRatio: preserveAspectRatio];
238238 if (!imageRef) continue ;
239239#if SD_MAC
240- UIImage *image = [[UIImage alloc ] initWithCGImage: imageRef scale: scale orientation: exifOrientation ];
240+ UIImage *image = [[UIImage alloc ] initWithCGImage: imageRef scale: scale orientation: kCGImagePropertyOrientationUp ];
241241#else
242- UIImageOrientation orientation = [SDImageCoderHelper imageOrientationFromEXIFOrientation: exifOrientation];
243- UIImage *image = [[UIImage alloc ] initWithCGImage: imageRef scale: scale orientation: orientation];
242+ UIImage *image = [[UIImage alloc ] initWithCGImage: imageRef scale: scale orientation: UIImageOrientationUp];
244243#endif
245244 CGImageRelease (imageRef);
246245
0 commit comments