I need to load in a 24-bit PNG mask image into my Android, and it
being a mask, I need it to come in exactly as it is on disk, with no
resizing or pixel values changed.

When I load it from resources using the BitmapFactory, its pixel
values are slightly changed, as if it had been resized *twice*: its
dimensions are the same as original, but values that were pure grey,
like (100,100,100) are now slightly off, as in (100,99,100), for
example, or (50,50,50) becomes (49,52,49), to take another example.

To ensure no resizing takes place I followed these steps:

#1. I have
<uses-sdk android:minSdkVersion="8" />
on my manifest.

I even added
<supports-screens android:anyDensity="true"/>
although in theory this is not needed since minSdkVersion is high.

#2. My source image is in the res/drawable-nodpi folder

#3. I load the image with inScaled false, as in

                BitmapFactory.Options options = new BitmapFactory.Options();
                options.inScaled = false;
                _bmMask = BitmapFactory.decodeResource(getResources(),
R.drawable.mask, options);

It is my understanding that either #2 or #3 alone should ensure no
resizing takes place.

Or course, one could claim no resizing takes place, since my image
that is 360x300 comes in at that exact dimension. However, how do I
explain that my image seems to have been somehow compressed/
decompressed?

I've already spent 3 hours scouring the internet for a solution to no
avail.
I have the latest Android SDK and Eclipse plug-in.

Regards,
/d42

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to