From 02efade7ffb61bf9d415490f5be49817916f7a9c Mon Sep 17 00:00:00 2001 From: morkt Date: Sat, 18 Jun 2016 11:02:33 +0400 Subject: [PATCH] (ImageFormat.Write): use overloaded BitmapFrame.Create method. incorrect metadata sometimes causes ArgumentException. --- GameRes/ImageBMP.cs | 2 +- GameRes/ImageJPEG.cs | 2 +- GameRes/ImagePNG.cs | 2 +- GameRes/ImageTIFF.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/GameRes/ImageBMP.cs b/GameRes/ImageBMP.cs index a27757a0..7f4c82d9 100644 --- a/GameRes/ImageBMP.cs +++ b/GameRes/ImageBMP.cs @@ -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); } diff --git a/GameRes/ImageJPEG.cs b/GameRes/ImageJPEG.cs index 572fed14..a39f23d0 100644 --- a/GameRes/ImageJPEG.cs +++ b/GameRes/ImageJPEG.cs @@ -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); } diff --git a/GameRes/ImagePNG.cs b/GameRes/ImagePNG.cs index 4a780e4e..6ab2aea0 100644 --- a/GameRes/ImagePNG.cs +++ b/GameRes/ImagePNG.cs @@ -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); diff --git a/GameRes/ImageTIFF.cs b/GameRes/ImageTIFF.cs index 8bc09c7c..90a007df 100644 --- a/GameRes/ImageTIFF.cs +++ b/GameRes/ImageTIFF.cs @@ -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); }