-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Large images are not being scaled down. #98
Comments
UIL scale original image according to different parameters. One of them is
If you have scaleType one of these:
|
Ahhh...my bad. Thanks so much for letting me know, great explanation. I should have tried other scale types. Thanks |
So the scale type fixes the issue. However, I am using a scale type of matrix to be able zoom in and out of image. Can you think of any way's to still have the UIL scale the image down even in matrix mode. |
Figured out a fix to just override getScaleType to return center inside, and internally use a image matrix to support zooming in and out. Seems to resolve the issues. |
@eggman87 could you explain your fix further? I'm also using TouchImageView with UIL and getting the same error. |
@hiv0lt sorry I never got back to you, I do not use github much...I really don't remember the problem much but the source code is available @ https://bitbucket.org/eggman87/ezimgur-open/src/3eba75879df8e266cbb4a08127dc1cfac30114c2/ezimgur/src/com/ezimgur/view/component/TouchImageView.java?at=default if you want to look at it. |
@hiv0lt re-read the comments, and I remember now. My custom image view was setting scale type to Matrix internally when I was initializing the view (for zooming). However, since this did not work well with UIL. A hack was to return CENTER_INSIDE always for getScaleType which is what the UIL was calling to determine scale type. My guess is that the internals of the image view itself don't call getScaleType to determine what scale type to use and instead just uses the private variable that is set on setScaleType (which would be returned normally on getScaleType). @Override
public ScaleType getScaleType() {
return ScaleType.CENTER_INSIDE;
} |
@eggman87 Ok, thanks. I ended up modifying the UIL library to except a targetSize in the displayImage method. For example: ImageSize targetSize = new ImageSize(120, 120);
imageLoader.displayImage(imageUrls[position], targetSize, holder.image, options); You can check out my app here |
Just wanted to comment that this issue really helped me out, to break it down for anyone who wasn't quite clear, use the scaleType centerInside to allow the logic to work, and if you are using a custom ImageView, override the class's getScaleType() method to return ScaleType.CENTER_INSIDE |
Not sure if this is supposed to be built into the library or not, but I thought from the documentation that the library will automatically handle scaling the image down based on the imageview size. Even when I set maxWidth and maxHeight to 1000 it still does not load image when the image is too large to be handled by android.
Maybe I am doing something wrong, below is more info on my code:
11-11 11:34:37.132: WARN/OpenGLRenderer(6863): Bitmap too large to be uploaded into a texture (460x5185, max=2048x2048)
My setup:
My Usage:
My View:
The text was updated successfully, but these errors were encountered: