onevcat/Kingfisher

ResizeImage is Jerking

Opened this issue · 3 comments

resizeImage.jerk.mov

Hello,
I am using resize image processor to resize image as per screen width and pre-defined maxHeight.
It is working fine. but image is shown before resize and then jerks after resize.

My code:

img.kf.indicatorType = .activity
img.kf.setImage(with: url, placeholder: nil,
                    options: [
                        .transition(.fade(0.5)),
                        .processor(ResizingImageProcessor(referenceSize: CGSize(width: img.frame.width, height: 300),
                                                          mode: .aspectFit))])

Can you please correct me if I am doing anything wrong.

Hi, @nickp4488

Based on the code you provided, it shouldn’t cause the issue you’re describing. However, I recommend checking if the setImage method is being called multiple times, possibly with different values for img.frame.width.

If that’s the case, please ensure that the setImage is called at the correct timing. If the image size depends on the current view hierarchy, make sure to set the image after the layout has completed to obtain the correct width.

Hello @onevcat
I am reloading cell manually after a second,
If I stop reloading cell then image is shown as ssail origional without resizing.
After reload cell, resize image will show.

Hi, @nickp4488

Based on the code you provided, it shouldn’t cause the issue you’re describing. However, I recommend checking if the setImage method is being called multiple times, possibly with different values for img.frame.width.

If that’s the case, please ensure that the setImage is called at the correct timing. If the image size depends on the current view hierarchy, make sure to set the image after the layout has completed to obtain the correct width.

can you please check this issue if possible?
thank you,