alansiqueira27
alansiqueira27

Reputation: 8506

BitmapSource.Create error - Buffer size is not large enough

I have this code:

BitmapSource.Create(pixelWidth, pixelHeight,
                    dpiX, dpiY, image.Format, image.Palette,
                    _modifiedRgb, stride);

This is throwing an

ArgumentException - The buffer size is not enough.

Any ideas please?

Upvotes: 2

Views: 4135

Answers (1)

SLaks
SLaks

Reputation: 887385

That would mean that your _modifiedRgb isn't big enough.
It needs to contain Height * Stride * Format.BitsPerPixel/8 bytes.

Upvotes: 4

Related Questions