diff --git a/OpenRA.Game/Map/Map.cs b/OpenRA.Game/Map/Map.cs index 782c7fdbf8..b61ed70706 100644 --- a/OpenRA.Game/Map/Map.cs +++ b/OpenRA.Game/Map/Map.cs @@ -12,6 +12,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Drawing; +using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Security.Cryptography; @@ -391,8 +392,16 @@ namespace OpenRA DefaultSubCell = (SubCell)Game.ModData.Manifest.SubCellDefaultIndex; if (Container.Exists("map.png")) + { using (var dataStream = Container.GetContent("map.png")) CustomPreview = new Bitmap(dataStream); + if (CustomPreview.PixelFormat != PixelFormat.Format32bppArgb) + { + var original = CustomPreview; + CustomPreview = original.Clone(original.Bounds(), PixelFormat.Format32bppArgb); + original.Dispose(); + } + } PostInit(); diff --git a/OpenRA.Game/Map/MapPreview.cs b/OpenRA.Game/Map/MapPreview.cs index fb843d1eaa..ab3bbd3402 100644 --- a/OpenRA.Game/Map/MapPreview.cs +++ b/OpenRA.Game/Map/MapPreview.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Drawing; +using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Net; @@ -155,6 +156,12 @@ namespace OpenRA SpawnPoints = spawns; CustomPreview = new Bitmap(new MemoryStream(Convert.FromBase64String(r.minimap))); + if (CustomPreview.PixelFormat != PixelFormat.Format32bppArgb) + { + var original = CustomPreview; + CustomPreview = original.Clone(original.Bounds(), PixelFormat.Format32bppArgb); + original.Dispose(); + } } catch (Exception) { }