我正在尝试将字节数组解压缩为位图。但得到错误。 这是我的编码....执行时会产生错误,即"索引超出了数组的范围。"
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
private static byte[] minbuffer;
static void Main(string[] args)
{
byte[] buffer = new byte[] { 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x83,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x1B,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x7B,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xF9,0xFF,0xFF,0xFF,0xFF,0xFF,0xBF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF9,0xF9,0xFF,0xFF,0xFF,0xFF,0xFF,0x87,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF9,0xF9,0xFF,0xFF,0xFF,0xFF,0xFF,0xC3,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFB,0xF9,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC3,0xF9,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC3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xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC6,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x90,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xE3,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF };
buffer = decompress(buffer, 168, 44);
Console.ReadLine();
}
private static byte[] decompress(byte[] raw, int width, int height)
{
byte[] signdecompress = new byte[width * height];
for (int h = 0; h < height; h++)
{
for (int w = 0; w < (width / 8); w++)
{
byte num = raw[h * (width / 8) + w];
int ByteIndex = (h * width + w * 8);
string str = Convert.ToString(num);
for (byte s = 0; s < 8; s++)
{
if (str[s] == '1')
{
signdecompress[ByteIndex + s] = (byte)(255);
}
else
signdecompress[ByteIndex + s] = (byte)(0);
}
}
}
return signdecompress;
}
}
}
请帮忙。我需要结果成为
0xFF,0xD8,0xFF,0xE0,0x00,0x10,0x4A,0x46,0x49,0x46,0x00,0x01,0x01,0x00,0x00,0x01,0x00,0x01,0x00,0x00,0xFF,0xDB,0x00,0x43,0x00,0x02,0x02,0x02,0x02,0x02,0x01,0x02,0x02,0x02,0x02,0x03,0x02,0x02,0x03,0x03,0x06,0x04,0x03,0x03,0x03,0x03,0x07,0x05,0x05,0x04,0x06,0x08,0x07,0x09,0x08,0x08,0x07,0x08,0x08,0x09,0x0A,0x0D,0x0B,0x09,0x0A,0x0C,0x0A,0x08,0x08,0x0B,0x0F,0x0B,0x0C,0x0D,0x0E,0x0E,0x0F,0x0E,0x09,0x0B,0x10,0x11,0x10,0x0E,0x11,0x0D,0x0E,0x0E,0x0E,0xFF,0xC0,0x00,0x0B,0x08,0x00,0x2C,0x00,0xA8,0x01,0x01,0x11,0x00,0xFF,0xC4,0x00,0x1F,0x00,0x00,0x01,0x05,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0xFF,0xC4,0x00,0xB5,0x10,0x00,0x02,0x01,0x03,0x03,0x02,0x04,0x03,0x05,0x05,0x04,0x04,0x00,0x00,0x01,0x7D,0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,0x22,0x71,0x14,0x32,0x81,0x91,0xA1,0x08,0x23,0x42,0xB1,0xC1,0x15,0x52,0xD1,0xF0,0x24,0x33,0x62,0x72,0x82,0x09,0x0A,0x16,0x17,0x18,0x19,0x1A,0x25,0x26,0x27,0x28,0x29,0x2A,0x34,0x35,0x36,0x37,0x38,0x39,0x3A,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4A,0x53,0x54,0x55,0x56,0x57,0x58,0x59,0x5A,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8A,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9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9B,0xA8,0xEE,0x35,0x07,0x96,0x6D,0x42,0xEA,0x19,0x3C,0xD1,0x17,0xEE,0xE5,0xB4,0x1B,0x62,0x0F,0xE5,0xAC,0x98,0x64,0xF6,0x0F,0x83,0xBF,0x00,0xBE,0x0D,0xFE,0xCF,0xFE,0x05,0x97,0xC3,0xBF,0x07,0xBE,0x1E,0xE9,0x5E,0x07,0xB0,0x9F,0x1F,0x6C,0x96,0xD1,0x1A,0x4B,0xBB,0xDC,0x3C,0x8E,0x9F,0x68,0xBA,0x90,0xB4,0xD3,0xEC,0x33,0x49,0xB3,0xCC,0x76,0xD8,0x1B,0x6A,0xE0,0x71,0x5E,0xBF,0x45,0x14,0x51,0x45,0x14,0x51,0x45,0x14,0x51,0x45,0x14,0x57,0xE5,0x0F,0xED,0x6F,0xE3,0x2F,0x1D,0x7C,0x52,0xFF,0x00,0x82,0xC9,0x7C,0x1E,0xFD,0x86,0x1F,0xC6,0xFA,0xAF,0x81,0x3E,0x09,0xFC,0x43,0xF0,0x05,0xE5,0xFF,0x00,0x8C,0x25,0xF0,0xAF,0x93,0x06,0xAF,0xA8,0xFE,0xEF,0x51,0x7F,0x23,0xED,0x53,0x47,0x2E,0xC8,0x7F,0xE2,0x5B,0x1A,0x94,0x45,0x5D,0xE9,0x3C,0xE9,0x26,0xF5,0x60,0x17,0xED,0xFF,0x00,0x85,0xDF,0xB2,0xAF,0xEC,0xE3,0xF0,0x5F,0xFB,0x0E,0x6F,0x86,0x9F,0x06,0x3C,0x2B,0xE1,0xBD,0x5B,0x47,0xF3,0xBF,0xB3,0xB5,0xCF,0xEC,0xB5,0xB9,0xD5,0xE1,0xF3,0xB7,0xF9,0x9F,0xE9,0xF3,0x6F,0xB9,0x39,0x12,0xBA,0x73,0x21,0xF9,0x0E,0xCF,0xBB,0xC5,0x7B,0xFD,0x14,0x51,0x45,0x14,0x51,0x45,0x14,0x51,0x5F,0xFF,0xD9
答案 0 :(得分:2)
我并不完全清楚你要在这里做什么,但错误的原因在于这一行:
for (byte s = 0; s < 8; s++)
它假定字符串 str 总是八个个字符。这样可以防止错误。
for (byte s = 0; s < str.Length; s++)
但它可能不会给你你想要的输出..?
答案 1 :(得分:0)
您的计划在以下行中断:
if (str[s] == '1')
在这一行,str
== 255.循环尝试在包含3的字符串中迭代8个位置。因此,当它达到索引3时,它变得越界(我们总是从0开始)
你的第3个和最内部的for
循环应该是:
for (byte s = 0; s < str.Length; s++;)
{
if (str[s] == '1')
signdecompress[ByteIndex + s] = (byte)255;
else
signdecompress[ByteIndex + s] = (byte)0;
}
基于某些内容的Length
或string
的{{1}}进行迭代始终是最佳做法,除非您明确知道您将始终只拥有指定数量的索引。