Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha channel 255 all the time #7

Open
zbigniewcebula opened this issue Apr 25, 2021 · 3 comments
Open

Alpha channel 255 all the time #7

zbigniewcebula opened this issue Apr 25, 2021 · 3 comments
Labels
question Further information is requested

Comments

@zbigniewcebula
Copy link

zbigniewcebula commented Apr 25, 2021

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");

door
obraz

@EliotJones
Copy link
Owner

EliotJones commented Apr 25, 2021

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 

@EliotJones EliotJones added the question Further information is requested label Apr 25, 2021
@zbigniewcebula
Copy link
Author

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?

@ZaneDubya
Copy link
Contributor

ZaneDubya commented Jun 18, 2021

This may be the same issue as #8 (or it might not!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants