Kman
Kman

Reputation: 2579

Transparent PNG image not looking nice

I have an image that has a fairly large shadow around it and its background is transparent. I have saved it as a PNG file from photoshop and am using it in an ImageView through xml. This results in the shadow having a banding effect and just doesn't look nice. Not too sure what to do...

Upvotes: 3

Views: 7799

Answers (3)

peceps
peceps

Reputation: 17557

Just add

// set 32 bit window (draw correctly transparent images)
getWindow().getAttributes().format = android.graphics.PixelFormat.RGBA_8888;

in onCreate(...)

http://www.curious-creature.org/2010/12/08/bitmap-quality-banding-and-dithering/

Upvotes: 8

Kevin Coppock
Kevin Coppock

Reputation: 134684

I can't remember where I read it, but on the developer site somewhere there was this suggestion for fixing gradient banding; it might help with the shadow as well. Right click the effects icon on the layer that has the shadow, and click "Create Layer" to make a separate layer for the shadow. Then apply an "Add Noise..." filter to the layer with the following settings:

(in case the image ever disappears, Amount:0.5%, Uniform, Monochromatic)

Upvotes: 0

John
John

Reputation: 810

I can't remember what this property was used on, but I think it was an ImageView.

Try using android:dither="true" as part of the ImageView xml declaration and see if that helps.

Upvotes: 0

Related Questions