(ImageFormat.Write): use overloaded BitmapFrame.Create method.

incorrect metadata sometimes causes ArgumentException.
This commit is contained in:
morkt 2016-06-18 11:02:33 +04:00
parent 92ad52ca43
commit 02efade7ff
4 changed files with 4 additions and 4 deletions

View File

@ -72,7 +72,7 @@ namespace GameRes
public override void Write (Stream file, ImageData image)
{
var encoder = new BmpBitmapEncoder();
encoder.Frames.Add (BitmapFrame.Create (image.Bitmap));
encoder.Frames.Add (BitmapFrame.Create (image.Bitmap, null, null, null));
encoder.Save (file);
}

View File

@ -61,7 +61,7 @@ namespace GameRes
{
var encoder = new JpegBitmapEncoder();
encoder.QualityLevel = Quality;
encoder.Frames.Add (BitmapFrame.Create (image.Bitmap));
encoder.Frames.Add (BitmapFrame.Create (image.Bitmap, null, null, null));
encoder.Save (file);
}

View File

@ -52,7 +52,7 @@ namespace GameRes
public override void Write (Stream file, ImageData image)
{
var encoder = new PngBitmapEncoder();
encoder.Frames.Add (BitmapFrame.Create (image.Bitmap));
encoder.Frames.Add (BitmapFrame.Create (image.Bitmap, null, null, null));
if (0 == image.OffsetX && 0 == image.OffsetY)
{
encoder.Save (file);

View File

@ -58,7 +58,7 @@ namespace GameRes
{
var encoder = new TiffBitmapEncoder();
encoder.Compression = TiffCompressOption.Zip;
encoder.Frames.Add (BitmapFrame.Create (image.Bitmap));
encoder.Frames.Add (BitmapFrame.Create (image.Bitmap, null, null, null));
encoder.Save (file);
}