简体   繁体   English

获取24位PNG像素值

[英]Get 24 bit PNG pixel value

I'm decoding a 24 bit single channel grayscale PNG with BitmapFactory ( Config.ARGB_8888 ). 我正在使用BitmapFactoryConfig.ARGB_8888 )解码24位单通道灰度PNG。 Now I'v tried several ways (described here) to get the value of a pixel, but none returned the value I'm expecting. 现在,我尝试了几种方法(在此进行了描述)来获取像素值,但是没有一种方法返回我期望的值。

This one should give me the value for a 16 bit PNG, but doesn't seem to work in the 24 bit case: 这个应该给我16位PNG的值,但似乎在24位情况下不起作用:

int val = bitmap.getPixel(0,0)&0x0000ffff;

What's the right way to adress the value of a 24 bit PNG? 获取24位PNG值的正确方法是什么?

int val = bitmap.getPixel(0,0)&0x00ffffff;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM