Skip to content

Fix image scale issue in thumbnail creation#793

Merged
kean merged 2 commits into
kean:mainfrom
prabhuamol:imagescale
Jul 13, 2024
Merged

Fix image scale issue in thumbnail creation#793
kean merged 2 commits into
kean:mainfrom
prabhuamol:imagescale

Conversation

@prabhuamol

@prabhuamol prabhuamol commented Jun 21, 2024

Copy link
Copy Markdown

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

@prabhuamol prabhuamol mentioned this pull request Jun 21, 2024
func makeImage() -> PlatformImage? {
if let thumbnail {
return makeThumbnail(data: data, options: thumbnail)
return makeThumbnail(data: data,

Copy link
Copy Markdown
Author

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
}

#if canImport(UIKit)
let orientation: UIImage.Orientation

Copy link
Copy Markdown
Author

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

@prabhuamol prabhuamol changed the title Fix image scale issue with Nuke Fix image scale issue in thumbnail creation Jul 10, 2024
@kean

kean commented Jul 13, 2024

Copy link
Copy Markdown
Owner

Hey, thanks @prabhuamol. I think it looks really good now.

@kean

kean commented Jul 13, 2024

Copy link
Copy Markdown
Owner

I will update the tests in main.

@kean kean merged commit 97e1908 into kean:main Jul 13, 2024
@prabhuamol prabhuamol deleted the imagescale branch July 13, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants