-
-
Notifications
You must be signed in to change notification settings - Fork 533
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
Error resizing PNG-8 images #789
Comments
Thanks for reporting it and providing the details to reproduce it!
This line was introduced in order to address the following issues: #782 (comment). I think there is something I'm missing. |
Fixed in v12.7.2. RCAIt was a regression introduced in v12.7 in the scope of the fix for #782. In 12.7.0, I added the following line to the code that specified the alpha info for if image.bitsPerPixel == 8 {
return .none // The only pixel format supported for grayscale CS
} I assumed that 8 bpp was only valid for grayscale color spaces, but forgot about the packed pixel formats ( The new version has an additional condition: if colorSpace.numberOfComponents == 1 && image.bitsPerPixel == 8 {
return .none // The only pixel format supported for grayscale CS
} I can't say that I'm an expert in pixel formats, so if someone else could review it, that would be fantastic. I'm also open to suggestions for how to improve it. DebugHere's some more information from
|
Thanks for the quick fix! |
I'm working on an app that loads link previews from websites, so I don't have control over the format for the images I get. The one issue currently is with PNG-8 images. They will be fetched and render correctly at original size, but will get an error during resize:
So ultimately can't have an 8-bit/component RGB image with
kCGImageAlphaNone
. I was able to "fix" it by changing this line to any other value - https://github.com/kean/Nuke/blob/main/Sources/Nuke/Internal/Graphics.swift#L199Either
.premultipliedLast
,.premultipliedFirst
seem to work fine, but I'm not sure if that is the actual correct fix, and assuming it might break some other format. Here's an example image that reproduces the problem from Daylight's website. This URL will trigger the failure (https://daylightcomputer.com/_next/static/media/OG-homepage.c818d83e.png), also attached the image as well in case that link changes.The text was updated successfully, but these errors were encountered: