Skip to content

IIMage.Resize bugged behaviour #31103

@elTRexx

Description

@elTRexx

Description

When picking an image file from disk as a stream, getting an IImage using PlatformImage.FromStream() method, then apply a Resize() method on it then using IImage.SaveAsync() mthod to save the resized image result in several bugs :

  • On windows Machine, the first one works, but sequential call will overpaint the new PNG image over the last one (even if the last one was deleted before saving the new one !)
  • On Android, using disposeOriginal = true parameter on Resize() method, made the new returned resized IImage disposed ! (was expecting only the original IImage to be disposed), so the new resized IImage cannot be displayed.

Steps to Reproduce

  1. Clone repository below
  2. Run this MAUI project
  3. click on Pick image button
  4. select an PNG image file (2 examples are provided in the repo under Images folder : elipse_1920x1080.png and cross_1920x1080.png)

On Windows

  1. redo step 3 and 4 with another PNG image.
  2. See the resulting image is repainted above the last one.

On Android

  1. see it fail as no image is displayed (if you break code you can observe the resizedImage is disposed !)

Link to public reproduction project repository

https://github.com/elTRexx/ItemSelectWithToolTip

Version with bug

9.0.90 SR9

Is this a regression from previous behavior?

Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Windows, Android

Affected platform versions

Android API 28 (used for easier file access authorization) Windows SDK 10.0.19041.0

Did you find any workaround?

No

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions