diff --git a/OpenRA.Mods.Common/SpriteLoaders/PngSheetLoader.cs b/OpenRA.Mods.Common/SpriteLoaders/PngSheetLoader.cs index 6a6aa452de..562e5afd72 100644 --- a/OpenRA.Mods.Common/SpriteLoaders/PngSheetLoader.cs +++ b/OpenRA.Mods.Common/SpriteLoaders/PngSheetLoader.cs @@ -45,13 +45,16 @@ namespace OpenRA.Mods.Common.SpriteLoaders public bool TryParseSprite(Stream s, out ISpriteFrame[] frames, out TypeDictionary metadata) { metadata = null; + frames = null; if (!Png.Verify(s)) - { - frames = null; return false; - } var png = new Png(s); + + // Only supports paletted images + if (png.Palette == null) + return false; + List frameRegions; List frameOffsets; diff --git a/OpenRA.Mods.Common/UtilityCommands/ConvertPngToShpCommand.cs b/OpenRA.Mods.Common/UtilityCommands/ConvertPngToShpCommand.cs index 53a337c832..33316b0ec3 100644 --- a/OpenRA.Mods.Common/UtilityCommands/ConvertPngToShpCommand.cs +++ b/OpenRA.Mods.Common/UtilityCommands/ConvertPngToShpCommand.cs @@ -35,6 +35,9 @@ namespace OpenRA.Mods.Common.UtilityCommands var dest = inputFiles[0].Split('-').First() + ".shp"; var frames = inputFiles.Select(a => new Png(File.OpenRead(a))).ToList(); + if (frames.Any(f => f.Palette == null)) + throw new InvalidOperationException("All frames must be paletted"); + var size = new Size(frames[0].Width, frames[0].Height); if (frames.Any(f => f.Width != size.Width || f.Height != size.Height)) throw new InvalidOperationException("All frames must be the same size");