Thank you all for your input. Here's the solution: http://stuffthathappens.com/blog/2010/06/04/android-color-banding/
in short: Window.setFormat(PixelFormat.RGBA_8888); ! Cheers, Hatch On Nov 5, 6:10 am, Adam Hammer <[email protected]> wrote: > Since you use it in a ImageView I do not know how to set the bitmap > preferences. > > You will probably have to load the Bitmap in code, and then assign it > to the ImageView once loaded. > E.g. > BitmapFactory.Options myOptions = new > BitmapFactory.Options(); > myOptions.inDither = true; > myOptions.inScaled = false; > myOptions.inPreferredConfig = > Bitmap.Config.ARGB_8888; > myOptions.inDither = false; > myOptions.inPurgeable = true; > preparedBitmap = > BitmapFactory.decodeResource(CTX.getResources(), > R.drawable.myImage, myOptions); > new line -------> MyImageView.setImageBitmap(preparedBitmap); > > I don't know if you can specify image loading configs in the xml for a > ImageView. > > On Nov 4, 1:33 am,Hatch<[email protected]> wrote: > > > > > > > > > Great > > > Your reply gives me hope :) > > > But can you provide me with more information on how to do it ? > > > I have a gradient alpha png. > > I just use it in imageView inside an XML resource. > > I don't set the dither option (although have tried both true and false > > options with same result) > > And I get the bands. > > > Do I need to draw the image by hand, and which API must I use in that > > case ? > > > Regards, > > >Hatch > > > On Nov 4, 1:19 am, Adam Hammer <[email protected]> wrote: > > > > It get's banded because Android automatically decodes images based on > > > your screen, and not based on the actual image. Why decode a 2048x2048 > > > image when it's showing on a 800x480 screen. This I assume is to save > > > cpu cycles and speed up image decoding where it normally will not have > > > a issue. > > > > When you are doing compositing though it does make a difference, and > > > you need to be specific as to how you want the image decoded. > > > > Like I said before, you need to manually define your options to ensure > > > it uses ARGB_8888 when decoding the image, disable dithering and > > > scaling. > > > > Do this and you will no longer have banding. > > > > Adam > > > > On Nov 2, 1:01 am,Hatch<[email protected]> wrote: > > > > > Yes, Thank you for your replies. > > > > > I have read the article but it doesn't explain why alpha enabled > > > > resource get's banded :( > > > > > Is there a way to know exactly which RGB is used in the png ? > > > > > BTW the dither option didn't work in the XML nor in the code. > > > > > On Oct 30, 2:04 am, Lance Nanek <[email protected]> wrote: > > > > > > I saw an interesting article on avoiding this the other > > > > > day:http://android.nakatome.net/2010/04/bitmap-basics.html > > > > > > On Oct 29, 7:01 pm,Hatch<[email protected]> wrote: > > > > > > > Seems my original post ("ugly pngs...") somehow disappeared :( > > > > > > nvm. > > > > > > > I have a problem with a png resource that has gradient fade-out > > > > > > alpha. > > > > > > > The png looks great in the emulator, but displays an artefact known > > > > > > as > > > > > > "color banding" (http://en.wikipedia.org/wiki/Colour_banding) > > > > > > > Has anyone surpassed this issue ? > > > > > > > My designer wants to trop a shadow behind his icons, and that's > > > > > > where > > > > > > the bands appear. > > > > > > > What are my options ? > > > > > > > Thanks > > > > > > >Hatch > > > > > > > BTW is there any way to see all my posts here on google groups ? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

