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

No Support for PNGs with Palettes #1

Open
Peardian opened this issue Jan 17, 2016 · 1 comment
Open

No Support for PNGs with Palettes #1

Peardian opened this issue Jan 17, 2016 · 1 comment

Comments

@Peardian
Copy link
Owner

Texture Remix will fail to load any PNG that uses indexed palettes. There should be a way to check of the loaded image uses an indexed palette and, if so, translate the palette into RGB(A) when loading the pixels.

@craftyfirefox
Copy link

You could use
if( image.getType() == BufferedImage.TYPE_BYTE_INDEXED )
to check for 8 bit paletted, then use
int[] argbvals = image.getRGB( 0, 0, getWidth(), getHeight(), null, 0, getWidth() );
to retrieve the values in "real" format. Might be a lot slower than directly accessing the databuffer as you do now, but has the great advantage of "not having to take care for anything else". BTW, since you only load those pixels once, using the getRGB-Method for all your needs might be a way to go anyways.

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

No branches or pull requests

2 participants