Browse Source

Fixed Indexed-8 Palette images importing

flabbet 5 years ago
parent
commit
720f450084
1 changed files with 7 additions and 2 deletions
  1. 7 2
      PixiEditor/Models/IO/Importer.cs

+ 7 - 2
PixiEditor/Models/IO/Importer.cs

@@ -16,7 +16,12 @@ namespace PixiEditor.Models.IO
         /// <returns></returns>
         /// <returns></returns>
         public static WriteableBitmap ImportImage(string path, int width, int height)
         public static WriteableBitmap ImportImage(string path, int width, int height)
         {
         {
-            var wbmp = ImportImage(path).Resize(width, height, WriteableBitmapExtensions.Interpolation.NearestNeighbor);
+            var wbmp = ImportImage(path);
+            if (wbmp.PixelWidth != width || wbmp.PixelHeight != height)
+            {
+                return wbmp.Resize(width, height, WriteableBitmapExtensions.Interpolation.NearestNeighbor);
+            }
+
             return wbmp;
             return wbmp;
         }
         }
 
 
@@ -32,7 +37,7 @@ namespace PixiEditor.Models.IO
             bitmap.UriSource = uri;
             bitmap.UriSource = uri;
             bitmap.EndInit();
             bitmap.EndInit();
 
 
-            return new WriteableBitmap(bitmap);
+            return BitmapFactory.ConvertToPbgra32Format(bitmap);
         }
         }
 
 
         public static Document ImportDocument(string path)
         public static Document ImportDocument(string path)