dotnet / dotnet/wpf

TransformedBitmap fails with OutOfMemoryException

Open
#6,601 8 comments 1 reaction 0 assignees View on GitHub
needs more information
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

I use Win7(x64) + FW4.8 + VS2019

In my WPF app I need medium bitmap 2000x2000, which I create by internet sample:

var src1x1 = BitmapSource.Create(1, 1, 72, 72, PixelFormats.BlackWhite, BitmapPalettes.BlackAndWhite, new byte[] { 0xFF }, 1);
var src = new TransformedBitmap(src1x1, new ScaleTransform(2000, 2000));// here I get Exception
cnvMain.Background = new ImageBrush(src);// cnvMain = Canvas

Last call before exception was:
System.Windows.Media.Imaging.TransformedBitmap.FinalizeCreation()

Even having a LOT of memory and x64 app I get this problem - why TransformedBitmap is unable to handle such simple image? It's not heavy in terms of graphics, even x86 app(having 2GB) must easy handle it.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.