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

Image asset size ignored, no scaling #1200

Closed
mmakmw opened this issue May 3, 2019 · 4 comments · Fixed by #1225
Closed

Image asset size ignored, no scaling #1200

mmakmw opened this issue May 3, 2019 · 4 comments · Fixed by #1225

Comments

@mmakmw
Copy link

mmakmw commented May 3, 2019

When using image assets in an animation, the image size defined in the .json is ignored. The image is not scaled to the defined width and height. It's displayed exactly as big as the image asset is.

In my example, the animation is 100x100 and the image asset is 100x100 px. If I use an image asset with 200x200 px (for a better resolution), only a part of the image is visible since it is not scaled to 100x100 to fit in the animation view.

{...,"assets":[{ "id":"image_0","w":100,"h":100,"u":"images/","p":"img_0.png","e":0 }],...}

Different LottieAnimationView configurations with scaleType or lottie_scale did not help.

I know, image scaling is working on the iOS implementation. Is this not supported yet on Android?

@mmakmw
Copy link
Author

mmakmw commented Jun 5, 2019

@gpeal Thanks for the fix.

  • Now, the images do get scaled to the size defined in JSON.
  • However, this produces the same result as if one would use an image of that size initially.

The desired result would be to have a higher image quality for displays with high dpi. Right now, the resulting image is always of the same low quality no matter of the source image size (quality).

Is there any way to increase the scaled image resolution for better quality?

@gpeal
Copy link
Collaborator

gpeal commented Jun 10, 2019

@mmakmw You can use a BitmapAssetDelegate like this

@arsen-h
Copy link

arsen-h commented Mar 10, 2020

Have a same issue
@mmakmw how did you fixed that?

@gpeal
in general, the problem is the same, with increasing image size, the container of this image also increases, but expected larger image in the same container.

On iOS, this is implemented without any additional settings.
Is this feature supported on android?

RESOLVED
the problem appears when using ImageAssetDelegate
when using setImageAssetsFolder everything works well
Is it possible to achieve that when using images from drawable?

gpeal pushed a commit that referenced this issue May 14, 2024
Currently, I am encountering a similar issue to [#1200](#1200), but in the case where the asset is a base64 image, it has not been fixed yet.
@Alrightque
Copy link

Heloc

jbeta51 pushed a commit to jbeta51/lottie-android that referenced this issue Jun 18, 2024
Currently, I am encountering a similar issue to [airbnb#1200](airbnb#1200), but in the case where the asset is a base64 image, it has not been fixed yet.
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

Successfully merging a pull request may close this issue.

5 participants
@gpeal @mmakmw @arsen-h @Alrightque and others