2

I loaded a 1 pixel image into a bitmap and then converted it to a byte[]

           _Image = "test.jpg";

            Bitmap testImage = new Bitmap(_Image);

            ImageConverter converter = new ImageConverter();
            byte[] byteTestImage =  (byte[])converter.ConvertTo(testImage,typeof(byte[]));

The single pixel has RGB values (255, 116, 25). Each of these can be represented by a byte, so I assumed that byteTestImage would correspond to this. But, byteTestImage is 635 elements in total.

What is the relationship between those bytes and the 1 pixel image?

4

2 回答 2

0

位图中的单个像素并不总是 RGB 格式。这完全取决于格式。您可以拥有一个 alfa 组件,您可以拥有一个像素矩阵所指的调色板等等……

签出:位图格式

于 2013-07-24T14:06:43.877 回答
0

您加载的文件是 JPG。它具有某些附加信息(宽度、高度、EXIF 数据),而不仅仅是颜色。看看https://en.wikipedia.org/wiki/JPEG

尝试在十六进制编辑器中打开它。您甚至可以阅读有关用于拍摄它的相机的信息。

于 2013-07-24T14:09:45.917 回答