You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Utilize new ImageDescriptor logic to allow for aspect ratio maintaining ResizeImages #61987
It is now possible for the framework to reason about the dimensions of the image before decoding. This should be reflected in ResizeImage so that aspect ratio can be maintained when resizing an image, particularly images coming from sources that may not be in the developer's control (e.g. a network image).
Reacted by Britannio Jarrett, Theeraphol Wattanavekin, Samuel, DarkMikey, Geoffrey Marizy and l1qu1d
@dnfield Does this issue have a priority status? After discovering the debugInvertOversizedImages flag via DevTools, I wanted to use ResizeImage however it isn't maintaining the aspect ratio of images.
I also found that I needed to multiply the size of the widget in logical pixels by MediaQuery.of(context).devicePixelRatio to calculate the cacheWidth and cacheHeight otherwise the image quality suffered, is that a bad idea?
@Mayb3Nots - how would it preserve aspect ratio if you specified both? :)
If you have an API suggestion we can talk some more. I started working on this a couple times and I think to get a really usable API it's going to require a significant revamp of the image API over all.
Activity
britannio commentedon Dec 27, 2020
@dnfield Does this issue have a priority status? After discovering the
debugInvertOversizedImagesflag via DevTools, I wanted to useResizeImagehowever it isn't maintaining the aspect ratio of images.I also found that I needed to multiply the size of the widget in logical pixels by
MediaQuery.of(context).devicePixelRatioto calculate thecacheWidthandcacheHeightotherwise the image quality suffered, is that a bad idea?dnfield commentedon Dec 27, 2020
If you specify only width or only height it will maintain aspect ratio, but it's a bit confusing.
I think we can make this api better but it's not at the top of my list right now.
Mayb3Nots commentedon Aug 4, 2021
This is frustrating and weird at the same time. Why would it only maintain aspect ratio when only one parameter is specified.
dnfield commentedon Aug 16, 2021
@Mayb3Nots - how would it preserve aspect ratio if you specified both? :)
If you have an API suggestion we can talk some more. I started working on this a couple times and I think to get a really usable API it's going to require a significant revamp of the image API over all.
Add ResizeImagePolicy.cover (flutter#194665)