【问题标题】:Determine if TIFF image is grayscale or color using Visual Basic?使用 Visual Basic 确定 TIFF 图像是灰度还是彩色?
【发布时间】:2021-12-13 19:15:40
【问题描述】:
  1. 什么属性或 GetMethod 可以告诉我 TIFF 文件是灰度文件还是彩色文件? 有没有解释调色板、像素格式、图像属性、标志的书?

  2. 用户可能/需要将彩色 TIFF 图像转换为灰度图像。这是怎么做的 在 Visual Basic 中?

【问题讨论】:

标签: visual-studio tiff converters grayscale


【解决方案1】:

通过您的帮助,我找到了 LibTiff。它回答了我几乎所有的问题。所以这里有一些有效的代码。

Imports BitMiracle.LibTiff.Classic

Dim tifLeft As Tiff
Dim fileLeft As String

fileLeft = TNpath + "\" + fileNames(q)
tifLeft = Tiff.Open(fileLeft, "r") ' Tiff to read tags

 ' --- Get Gray or Color 
 Dim value = tifLeft.GetField(TiffTag.PHOTOMETRIC)
 Dim GorC As Integer = value(0).ToInt()
 imgLeftColor = False
  If GorC > 1 Then
      imgLeftColor = True
  Else
      imgLeftColor = False
  End If

【讨论】:

    猜你喜欢
    • 2012-01-09
    • 2014-07-18
    • 1970-01-01
    • 2013-12-02
    • 2013-03-13
    • 2014-07-02
    • 1970-01-01
    • 1970-01-01
    • 2021-10-06
    相关资源
    最近更新 更多