Skip to content

Commit

Permalink
Apply magenta filtering to all non indexed masked images
Browse files Browse the repository at this point in the history
  • Loading branch information
danwilkins committed Oct 4, 2023
1 parent 4cb80ac commit a58e715
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions LanternExtractor/Infrastructure/ImageWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,14 @@ private static void WriteBmpAsPng(byte[] bytes, string filePath, string fileName
fileName = "canwall1.png";
}

switch (image.PixelFormat)
if (image.PixelFormat == PixelFormat.Format8bppIndexed && isMasked)
{
case PixelFormat.Format8bppIndexed:
if (isMasked)
{
var paletteIndex = GetPaletteIndex(fileName);
image.MakePaletteTransparent(paletteIndex);
}
break;
default:
image.MakeMagentaTransparent();
break;
var paletteIndex = GetPaletteIndex(fileName);
image.MakePaletteTransparent(paletteIndex);
}
else
{
image.MakeMagentaTransparent();
}

image.WritePng(Path.Combine(filePath, fileName));
Expand Down

0 comments on commit a58e715

Please sign in to comment.