-
-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix image scale issue in thumbnail creation #793
Conversation
@@ -52,7 +52,9 @@ extension ImageDecoders { | |||
|
|||
func makeImage() -> PlatformImage? { | |||
if let thumbnail { | |||
return makeThumbnail(data: data, options: thumbnail) | |||
return makeThumbnail(data: data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use scale in creating a thumbnail similar to how ImageDecoders.Default._decode(data, scale: scale)
is using it below
more tests use scale make scale non optional docs
@@ -366,7 +383,22 @@ func makeThumbnail(data: Data, options: ImageRequest.ThumbnailOptions) -> Platfo | |||
guard let image = CGImageSourceCreateThumbnailAtIndex(source, 0, options as CFDictionary) else { | |||
return nil | |||
} | |||
|
|||
#if canImport(UIKit) | |||
let orientation: UIImage.Orientation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is needed to make sure the returned image has the same orientation as the original. Verified via tests below with .right and .up orientation images
Hey, thanks @prabhuamol. I think it looks really good now. |
I will update the tests in |
Potential fix for #791 Also makes sure resized images have the same orientation as the original image
Also renamed the image which was right oriented correctly