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

Change BitmapUtil.MAX_BITMAP_SIZE dynamically based on the device #916

Closed
Lee-Wang-Jing opened this Issue Jan 15, 2016 · 8 comments

Comments

Projects
None yet
6 participants
@Lee-Wang-Jing
Copy link

Lee-Wang-Jing commented Jan 15, 2016

when i load a long image,enlarge this Image,Can't read the words on the picture,Very low quality

@sillydong

This comment has been minimized.

Copy link

sillydong commented Jan 15, 2016

When we zoom in image which has large height toward width, it is displayed in very low quality.

ps. we are using v0.8.1

longimage
displaying

@michalgr

This comment has been minimized.

Copy link
Contributor

michalgr commented Jan 15, 2016

Could you help us debugging this by capturing debug logs ? Here is the description how to do this: http://frescolib.org/docs/troubleshooting.html#setting-up-logcat

@kunny

This comment has been minimized.

Copy link
Contributor

kunny commented Jan 16, 2016

There are several causes related to this issue:

  • Source image's aspect ratio
  • Fresco's max supported width/height in resizing

Source image's aspect ratio

The image's dimension that you have uploaded is 440x4200px, which is too long. I recommend making it smaller to fit into at least 1:2 (width:height), for example, 440*700 per each image, sliced in six.

Fresco's max supported width/height in resizing

If you ResizeOptions, the converted one has a max size of 2048px, which makes wide or long image's quality low. If you can cut the source into smaller one, its quality will be better.

@michalgr Is there any plan to make BitmapUtil.MAX_BITMAP_SIZE user-configurable?

@michalgr

This comment has been minimized.

Copy link
Contributor

michalgr commented Jan 16, 2016

@kunny not at the moment. What is the desired limit you want to use ?

@kunny

This comment has been minimized.

Copy link
Contributor

kunny commented Jan 17, 2016

@michalgr It depends on each device, so it can't be defined as a constant.

I'm using the modified version of fresco, which can support larger image after resizing the source image.
(kunny@4bc9387)

It accepts ResizeOptions with a max bitmap size supported by the device, and then do a resize within the limit. It can make output image have a better quality than before.

However, before using this method, developer must sure that given maxSupportedSize does not exceeds the device's actual limit.

@balazsbalazs

This comment has been minimized.

Copy link
Member

balazsbalazs commented Jan 20, 2016

Not sure to be honest. I'm a bit afraid exposing this. I'm afraid that a lot of people will not be familiar with the memory consequences and just change it to a very large limit.

@balazsbalazs

This comment has been minimized.

Copy link
Member

balazsbalazs commented Jan 20, 2016

So according to @tyronen :
"We picked a default of 2048x2048.The thing is, many devices actually do support 4096x4096. But the only way to tell that is to use a nonstatic Canvas method. You need 1) a real, hw-accelerated Canvas, and 2) an API 14+ device.
At most we could expose a method that takes a Canvas argument and adjusts the limit, but the user must call it from within a draw method somewhere. Or we could hit it from the first Drawee to get drawn."

I wouldn't make the BitmapUtil.MAX_BITMAP_SIZE user-configurable, but option two could be doable: adjusting the size automatically on the first draw call.

To be fair, this would be very low on our priority list but we're always happy to see a pull request :) @kunny : would you like to create one?

@balazsbalazs balazsbalazs changed the title long image enlarge vague Change BitmapUtil.MAX_BITMAP_SIZE dynamically based on the device Jan 20, 2016

@kirwan

This comment has been minimized.

Copy link
Contributor

kirwan commented Sep 4, 2017

A change has been made to enable larger bitmap sizes if requested.

We're cleaning up long-untouched issues so I'm closing this one.

If you think this is still an issue, feel free to comment and we can re-open.

@kirwan kirwan closed this Sep 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment