-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Image not being properly rotated if ImageProcessor is applied #535
Comments
Umm..The The final processor might be something like this: struct NormalizingProcessor: ImageProcessor {
let identifier = "normalized"
func process(item: ImageProcessItem, options: KingfisherOptionsInfo) -> Image? {
switch item {
case .image(let image):
return image.kf.normalized
case .data(_):
return (DefaultImageProcessor() >> self).process(item: item, options: options)
}
}
}
let p = BlurImageProcessor(blurRadius: r) >> NormalizingProcessor()
imageView.kf.setImage(with: URL(string: ""), options: [.processor(p)]) |
If it is the case that the processors do not affect rotation at all then not sure why image.kf.setImage(with: image) and image.kf.setImage(with: image, placeholder: nil, options: [.processor(processor)]) gives different rotation results? Anyway your recommendation with normalize did do the trick - thanks! |
It is due to the cgImage based filter. I will give it a better fix now. |
Fixed in 3.2.3. |
@onevcat Hi again. I am using the latest version of KingFisher, and the image is not correctly displayed. Is there a way to fix this? Because the above post mentioned that this was fixed in 3.2.3. The code snippet that I am using: imageView.kf.setImage(with: asset.fileURL, placeholder: asset.transientImage, options: [.backgroundDecode]) After the transformation of an UIImage object to PNG Data object, the So, set the image to UIImageView, the image is correctly displayed. But after the data is persisted on disk and load again by KingFisher, the orientation is wrong. |
As mentioned in your ref links, there is no exif information in a PNG file, so the rotation info in a JPEG will be lost in a PNG representation. I tried JPEG with non-unified orientation in latest Kingfisher and it works well in both loading from web or cache. (I was using this image: https://github.com/recurser/exif-orientation-examples/blob/master/Landscape_2.jpg for testing). If you are loading a JPEG with problem, may I know the image url so I could have a deep look into it. |
@onevcat oh sorry I mean I have problems with PNGs. I think I may address my problem by passing an custom RotateProcessor to the method. I was misunderstanding this GitHub issue, and thought it had something to do with processors. Since I also used blur. Turns out the problem is on my side. |
My image appears with the correct orientation with no processor applied. However, when a BlurProcessor is added to the image, the processor works correctly but the image is no longer rotated as it should be:
The text was updated successfully, but these errors were encountered: