GDI+如何获取PNG图片的Alpha通道值 本帖最后由 memoryland 于 2011-09-02 20:54:43 编辑 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 谢谢 LMAOhuaNL。我修改代码如下:Bitmap bmpfile = new Bitmap("xxx.png", true);Color bmpcolor = bmpfile.GetPixel(j, i);Rectangle rect = new Rectangle(0, 0, bmpfile.Width, bmpfile.Height);BitmapData bmpdata = bmpfile.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);unsafe{ byte* pIn = (byte*)(bmpdata.Scan0.ToPointer()); for (int i = 0; i < bmpdata.Height; i++) { for (int j = 0; j < bmpdata.Width; j++) { string str_alphabmp = pIn[0].ToString("X2")); ... } }}读出来的数据似乎是BGRA的排列,但Alpha通道值仍旧全部为0xFF。 自动升级的原理 一列数字,如何利用数组实现找到最大值??? C#在Winform中用水晶报表打印宽度问题(急,能帮我解决马上结贴给高分) 如何判断打印机状态,一个文件还没打完不打印下一个文件 C# 属性怎样指定类别 c# 查询数据库问题 怎么控制datagridview的某一column只能录入数字和小数点 c#如何调用delphi开发的webservice? tif 转换 pdf 高分相送:一个一直困扰我的问题,能解决的人立即给分。 刚学C#。想通过C#写个绩点查询,但? access 按照年或月或日统计sql语句怎么写?
我修改代码如下:Bitmap bmpfile = new Bitmap("xxx.png", true);
Color bmpcolor = bmpfile.GetPixel(j, i);
Rectangle rect = new Rectangle(0, 0, bmpfile.Width, bmpfile.Height);
BitmapData bmpdata = bmpfile.LockBits(rect, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
unsafe
{
byte* pIn = (byte*)(bmpdata.Scan0.ToPointer()); for (int i = 0; i < bmpdata.Height; i++)
{
for (int j = 0; j < bmpdata.Width; j++)
{
string str_alphabmp = pIn[0].ToString("X2"));
...
}
}
}
读出来的数据似乎是BGRA的排列,但Alpha通道值仍旧全部为0xFF。