【问题标题】:Different Color Depth Between Windows and C#Windows 和 C# 之间的不同颜色深度
【发布时间】:2015-03-04 20:16:03
【问题描述】:

我有一个灰度 TIFF 图像,Windows 属性说它的位深度是 4(这应该意味着它是 4 BPP),但是当我在 C# 中将图像作为位图打开时,pixelFormat 属性说它是Format8bppIndexed(8 BPP),是位图构造函数改变了像素格式还是我误解了什么?

【问题讨论】:

    标签: c# windows colors


    【解决方案1】:

    TIFF 格式是一个容器(如 ZIP)。一个 TIFF 文件可以包含包含不同文件/数据的各种帧。帧可以是位图。并且每个位图可以有不同的pixelFormat。 TIFF 文件可以(或可以)具有具有不同像素格式的预览位图。

    要获得第一帧的实际像素格式,您可以使用:

        Stream imageStreamSource = new FileStream("file.tif", FileMode.Open, FileAccess.Read, FileShare.Read);
        TiffBitmapDecoder decoder = new TiffBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
        BitmapSource bitmapSource = decoder.Frames[0];
    
        PixelFormat pixelFormat = bitmapSource.Format;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-27
      • 2016-08-21
      • 2013-09-27
      • 1970-01-01
      • 1970-01-01
      • 2011-10-09
      相关资源
      最近更新 更多