Skip to content

ImageCropper, SaveAs with BitmapFileFormat.Png seems like not PNG file but bitmap #3237

Open
@pkar70

Description

@pkar70

Describe the bug

A clear and concise description of what the bug is.

  • Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:

I have several PNG files (Android snapshots, 600x1024 pixels, with size about 400 kB. After cropping to about 300x350 pixels, and using imageCropper.SaveAs(.., BitmapFileFormat.Png) file size is almost same, and should be much smaller.
When I open such cropped file in Microsoft Imaging Suite Editor, and save as new PNG file, file size is four..five times smaller.

When I use ImageMagick to simply open/save (no edits):
magick convert Screenshot_20200413-223246.png magScreenshot_20200413-223246.png
file size is reduced from 452 KiB to 118 KiB.

Seems like imageCropper.SaveAs saves pixels in PNG but as bitmap, without any compression (should use deflate, as stated in PNG format description).

Steps to Reproduce

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

A clear and concise description of what you expected to happen.

Screenshots

If applicable, add screenshots to help explain your problem.

Environment

NuGet Package(s): 
6.0.0
Package Version(s): 

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [X] second 2019 Update (18363)
- [ ] Insider Build (build number: )

App min and target version:
- [ ] Fall Creators Update (16299)
- [X] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] Insider Build (xxxxx)

Device form factor:
- [X] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [X] 2019 (version: 16.4.2 ) 
- [ ] 2019 Preview (version: )

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug 🐛An unexpected issue that highlights incorrect behaviorgood first issueIssues identified as good for first-time contributorshelp wantedIssues identified as good community contribution opportunities

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions