简体   繁体   English

如何使用LibTiff c#禁用控制台上显示的警告消息#

[英]How to disable warnings messages displayed on console using LibTiff c#

I need help to stop annoying warnings displayed on my console . 我需要帮助来阻止我控制台上显示的恼人警告。

I'm getting the following warnings using an application that detects corrupted images . 我使用检测到损坏图像的应用程序收到以下警告。 The application works as expected but these messages appear. 应用程序按预期工作,但会显示这些消息。

ReadDirectory: Warning, C:\\find corrupted images\\a.TIF: unknown field with tag 50701 (0xc60d) encountered fillStrip: C:\\find corrupted images\\b.TIF: Read error at scanlin e -1; ReadDirectory:警告,C:\\查找损坏的图像\\ a.TIF:标记为50701(0xc60d)的未知字段遇到fillStrip:C:\\ find corrupted images \\ b.TIF:在scanlin e -1读取错误; got 7115 bytes, expected 10130 ReadDirectory: Warning, C:\\find corrupted images\\c: unknown field wit h tag 33885 (0x845d) encountered ReadDirectory: Warning, C:\\find corrupted images\\d: unknown field wit h tag 50701 (0xc60d) encountered ReadDirectory: Warning, C:\\find corrupted images\\e: 得到7115字节,预期10130 ReadDirectory:警告,C:\\找到损坏的图像\\ c:未知字段,带有标签33885(0x845d)遇到ReadDirectory:警告,C:\\查找损坏的图像\\ d:未知字段带标签50701(0xc60d遇到ReadDirectory:警告,C:\\查找损坏的图像\\ e:

LibJpeg: Warning, Corrupt JPEG data: 11021 extraneous bytes before marker 0xD8 LibJpeg: Unexpected error LibJpeg:警告,损坏的JPEG数据:标记0xD8之前的11021个无关字节LibJpeg:意外错误

OJPEGSetupDecode: Warning, Depreciated and troublesome old-style JPEG compressio n mode, please convert to new-style JPEG compression and notify vendor of writin g software OJPEGReadHeaderInfoSecStreamSof: OJPEGSetupDecode:警告,折旧和麻烦的旧式JPEG压缩模式,请转换为新式JPEG压缩并通知供应商的写作软件OJPEGReadHeaderInfoSecStreamSof:

ReadDirectory: Warning, SamplesPerPixel tag is missing, assuming correct Samples PerPixel value is 1 ReadDirectory:警告,SamplesPerPixel标记丢失,假设样本PerPixel值为1

tif: unknown field with tag 50701 (0xc60d) encountered ReadDirectory: Warning, SamplesPerPixel tag is missing, assuming correct Samples PerPixel value is 1 tif:标记为50701(0xc60d)的未知字段遇到ReadDirectory:警告,SamplesPerPixel标记丢失,假设样本PerPixel值为1

Any ideas how to stop these messages appearing ? 任何想法如何阻止这些消息出现?

Thanks in advance 提前致谢

You should provide your own error handler to the library if you don't want warnings to appear in console. 如果您不希望警告出现在控制台中,则应该为库提供自己的错误处理程序。

Start by creating class which inherits from TiffErrorHandler and overloads WarningHandler and WarningHandlerEx methods. 首先创建继承自TiffErrorHandler的类,并重载WarningHandlerWarningHandlerEx方法。 Basically, you could do nothing in these methods. 基本上,你不能在这些方法中做任何事情。

Then set an instance of you class as the error handler for the library with SetErrorHandler method. 然后使用SetErrorHandler方法将您的类的实例设置为库的错误处理程序。 The method is static and you can set error handler before opening an image. 该方法是静态的,您可以在打开图像之前设置错误处理程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM