如何C#写的位图数据。它是自下而上还是自上而下? [英] How does C# write bitmap data. is it bottom up or top down?

查看:248
本文介绍了如何C#写的位图数据。它是自下而上还是自上而下?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据维基百科

像素阵列是32位双字的块,描述图像
  逐像素。通常,像素存储上下颠倒的关于
  到正常图像的光栅扫描顺序,开始在左下角,
  从左侧将右侧,然后通过行从底部排至
  图像的顶部。 1 Uncom pressed位图也可以存储的Windows
  从顶部至底部,当图片高度值是负的。

The pixel array is a block of 32-bit DWORDs, that describes the image pixel by pixel. Normally pixels are stored "upside-down" with respect to normal image raster scan order, starting in the lower left corner, going from left to right, and then row by row from the bottom to the top of the image.1 Uncompressed Windows bitmaps also can be stored from the top to bottom, when the Image Height value is negative.

所以,当我用这个code:

So, when I use this code:

b.Save(outputFilename, ImageFormat.Bmp);

如何C#实际上保存呢?我可以告诉C#将它与高度值负保存和它自上而下的方式写的?

How does C# actually save it ? Can I tell C# to save it with height value negative and write it in top down manner ?

推荐答案

图像codecInfo 为BMP格式似乎不支持任何恩coderParameters 。请参见这里上更多的细节。因此,似乎有没有办法来指定应该如何储存。至于找出如何它的的存储,只是尝试。让那黑色的上半部和下半部白色的图像,并查看它在一个十六进制编辑器。

The ImageCodecInfo for the BMP format does not seem to support any EncoderParameters. See here for more details on that. So there seems to be no way to specify how it should be stored. As to find out how it is stored, just try it. Make an image that's black in the upper half and white in the lower half and view it in a hex editor.

我敢打赌,它的'倒',因为它是默认的。

I bet it's 'upside-down' since it's the default.

这篇关于如何C#写的位图数据。它是自下而上还是自上而下?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆