Images Representing with Fewer Colors?

102 views Asked by At

I've got someone creating images (PNGs) for my Android application and they look great on the computer. As soon as I load them up on my device, it appears they're being reduced to a lower color-depth since my gradients end up having distinct color bands. I have placed the images in drawable-nodpi, and I have tried raw as well, but the image quality is always lost. I've also tried the Bitmap.Config.ARGB_8888 option as recommended through my searching. Still nothing. Even when I have him save as 16-bit color I get the same results. Only until he saves as 8-bit does it look exactly as on my computer, but then my graphics are rather lacking. I can't imagine I'm forced to use 8-bit graphics. How do I get the best possible graphics in my application?

Thanks!

2

There are 2 answers

0
CodeMonkey On BEST ANSWER

I finally figured out the magic words to search for and found the answer at:

Gradient appears banded in a SurfaceView, but looks very smooth in a normal View

I merely had to call

surfaceHolder_.setFormat(PixelFormat.RGBA_8888);
0
Joel Sjögren On

Enable dithering. Say you have a Paint paint:

paint.setDither(true);