Alpha channel 255 all the time
zbigniewcebula opened this issue · comments
I've got these door and while reading pixel by pixel alpha component is 255 on each one.
I've tried saving this PNG in GIMP without background color, but it doesn't help.
Using Visual Studio 2019 Community + BigGustave v1.0.3 from NuGet
Code snippet:
var stream = File.OpenRead(path);
Png image = Png.Open(stream);
Console.WriteLine("X = 255 / SPACE = 0");
for (int y = 0; y < image.Height; ++y)
{
for (int x = 0; x < image.Width; ++x)
{
Pixel px = image.GetPixel(x, y);
if(px.A == 255)
Console.Write("X");
else
Console.Write(" ");
}
Console.WriteLine("");
}
Console.WriteLine("\n");
Hi there, sorry you're encountering an issue.
I tried running the same code and I get 0 transparency on each white pixel. Perhaps try attaching the image inside a ZIP file in case GitHub does something weird to the uploaded image that means it works for me.
My output from your code with the attached image is:
X = 255 / SPACE = 0
XXXX
XXXXXXXX
XXX XXX
XX XX XX
X XXXXXX X
XX XXXXXXXX XX
XX XXXXXXXX XX
X XXXXX X
XX XX XX
XXXXXXXX XX XX
XX XX
X XXXXXXXX X
XX XX
XXXXXXXXXXXXXX
I actually ignored the problem and started using BLACK as transparent.
I investigated a bit, when removing alpha in GIMP there happened to be purple color inside "alpha pixels".
Is it possible that I saved PNG in a way that there was no alpha but one color was threaten as such?
Maybe that's why this weird thing happen?
This may be the same issue as #8 (or it might not!)