Skip to content

Utilize new ImageDescriptor logic to allow for aspect ratio maintaining ResizeImages #61987

Closed

Description

@dnfield

See #59578

See flutter-team-archive/engine#19537

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).

Activity

  1. added
    a: imagesLoading, displaying, rendering images
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Jul 21, 2020
  2. britannio commented on Dec 27, 2020

    @britannio

    @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?

  3. dnfield commented on Dec 27, 2020

    @dnfield
    ContributorAuthor

    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.

  4. Mayb3Nots commented on Aug 4, 2021

    @Mayb3Nots
    Contributor

    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.

    This is frustrating and weird at the same time. Why would it only maintain aspect ratio when only one parameter is specified.

  5. dnfield commented on Aug 16, 2021

    @dnfield
    ContributorAuthor

    @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.

  6. added
    P2Important issues not at the top of the work list
    on Aug 16, 2022
  7. self-assigned this
    on Oct 18, 2026
  8. added a commit that references this issue on Nov 7, 2026
    94f4471
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work lista: imagesLoading, displaying, rendering imagesframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions