fix: use kCGImageSourceCreateThumbnailFromImageAlways for full-res orientation fix
This commit is contained in:
parent
32e37d2b5f
commit
92b967bfc5
|
|
@ -345,9 +345,11 @@ final class ImageConverterDarwin implements ImageConverterPlatform {
|
||||||
final keys = arena<Pointer<Void>>(3);
|
final keys = arena<Pointer<Void>>(3);
|
||||||
final values = arena<Pointer<Void>>(3);
|
final values = arena<Pointer<Void>>(3);
|
||||||
|
|
||||||
// kCGImageSourceCreateThumbnailFromImageIfAbsent = kCFBooleanTrue
|
// kCGImageSourceCreateThumbnailFromImageAlways = kCFBooleanTrue
|
||||||
// Use 1.toNSNumber() — bool has no toNSNumber() extension; NSNumber(1) = YES.
|
// MUST use "Always" not "IfAbsent": iPhone HEIC files embed a tiny
|
||||||
keys[0] = kCGImageSourceCreateThumbnailFromImageIfAbsent.cast();
|
// ~240x320 JPEG thumbnail. "IfAbsent" returns that embedded thumbnail
|
||||||
|
// instead of decoding the full image, giving very low-resolution output.
|
||||||
|
keys[0] = kCGImageSourceCreateThumbnailFromImageAlways.cast();
|
||||||
values[0] = 1.toNSNumber().ref.retainAndAutorelease().cast();
|
values[0] = 1.toNSNumber().ref.retainAndAutorelease().cast();
|
||||||
|
|
||||||
// kCGImageSourceCreateThumbnailWithTransform = kCFBooleanTrue
|
// kCGImageSourceCreateThumbnailWithTransform = kCFBooleanTrue
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,17 @@ external ffi.Pointer<objc.CFString> kCGImagePropertyOrientation;
|
||||||
@ffi.Native<ffi.Pointer<objc.CFString>>()
|
@ffi.Native<ffi.Pointer<objc.CFString>>()
|
||||||
external ffi.Pointer<objc.CFString> kCGImageSourceCreateThumbnailFromImageIfAbsent;
|
external ffi.Pointer<objc.CFString> kCGImageSourceCreateThumbnailFromImageIfAbsent;
|
||||||
|
|
||||||
|
/// Key: when `kCFBooleanTrue`, ALWAYS creates a thumbnail from the full source
|
||||||
|
/// image data, ignoring any embedded thumbnail.
|
||||||
|
///
|
||||||
|
/// **Use this instead of [kCGImageSourceCreateThumbnailFromImageIfAbsent] when
|
||||||
|
/// full-resolution output is required.** iPhone HEIC files always contain a
|
||||||
|
/// tiny embedded JPEG thumbnail (~240×320). Without this key, ImageIO returns
|
||||||
|
/// the embedded thumbnail rather than decoding the full image, producing a very
|
||||||
|
/// low-resolution output regardless of [kCGImageSourceThumbnailMaxPixelSize].
|
||||||
|
@ffi.Native<ffi.Pointer<objc.CFString>>()
|
||||||
|
external ffi.Pointer<objc.CFString> kCGImageSourceCreateThumbnailFromImageAlways;
|
||||||
|
|
||||||
/// Key: when `kCFBooleanTrue`, rotates/flips the thumbnail to match the EXIF
|
/// Key: when `kCFBooleanTrue`, rotates/flips the thumbnail to match the EXIF
|
||||||
/// orientation tag, producing pixel-correct upright image data.
|
/// orientation tag, producing pixel-correct upright image data.
|
||||||
@ffi.Native<ffi.Pointer<objc.CFString>>()
|
@ffi.Native<ffi.Pointer<objc.CFString>>()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue