Skip to content
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

Blurry image with wrong scale after some non-trivial operations #813

Closed
rusik opened this issue Nov 23, 2017 · 2 comments
Closed

Blurry image with wrong scale after some non-trivial operations #813

rusik opened this issue Nov 23, 2017 · 2 comments

Comments

@rusik
Copy link

rusik commented Nov 23, 2017

Hi! I found a strange hard to reproduce issue.

You can check code to reproduce it here https://gist.github.com/Rusik/34efa7ad25eade5137ea1701df4db592

I will also try to explain in words what's happening.

So let's say I have:

  • url with 250x250 image
  • one image view with 100x100 points size
  • second image view with 88x88 points size

Launch app:

  • Clear cache to be sure everything is clean
  • Download image with options:
    • ResizingImageProcessor(100x100)
    • scaleFactor = 2
    • cacheOriginalImage
  • Image downloaded and saved to memory and disk cache

Restart app and after:

  • Retrieve image from cache by original url key without options
    • Image retrieved from disk
    • Image saved to memory cache
  • Download image with params
    • ResizingImageProcessor(88x88)
    • scaleFactor = 2
  • Get image with size = 88x88 and scale = 1 < This is not what I was expected

As I understand this happening because on step 1 on second launch the image was retrieved from disk with scale 1 and saved to memory cache with this scale.

It can be fixed by adding scaleFactor = 2 option to image retrieving task. But I think library still has some weird behaviour that I want an image with scale 2 and get blurry image with scale 1.

@onevcat
Copy link
Owner

onevcat commented Nov 23, 2017

@rusik I could verify this issue and yes you are correct on the reason. The problem is that the resizing processor (and maybe some other ones) are not respecting the option when applied to an image instead of data. They are just using the current image scale. And when you load the image to memory (as in task 1 of test 2), the image is loaded as scale 1 and it just use that cached image as a start point for processor. It could be fixed by always respecting the inputing scale option when existing.

For the blur image processor, please take notice that the blur is specified with pixel instead of point.

@onevcat
Copy link
Owner

onevcat commented Nov 30, 2017

Release in 4.4.0.

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

No branches or pull requests

2 participants