使用.NET查找损坏的tiff文件 [英] To find corrupted tiff files using .NET

查看:132
本文介绍了使用.NET查找损坏的tiff文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要找到使用.Net无法打开的已损坏的Tiff文件。任何人都可以帮助我。



我尝试过:



我试过这个但是没用了



public bool IsValidGDIPlusImage(string filename)

{

try <使用(var tiff = new Bitmap(filename))

$



返回true;

}



}

catch(例外情况)

{

MessageBox.Show(文件已损坏);



返回false;

}

}

I need to find corrupted Tiff file which is not opening using .Net. Anyone could help me out.

What I have tried:

I have tried this but of no use

public bool IsValidGDIPlusImage(string filename)
{
try
{
using (var tiff = new Bitmap(filename))
{

return true;
}

}
catch (Exception ex)
{
MessageBox.Show("The file is corrupted");

return false;
}
}

推荐答案

虽然我没试过这个,但你的问题似乎在以下主题中有答案。请检查并查看这些是否有帮助 -

读取图像并确定其损坏的C# - 堆栈溢出 [ ^ ]

如何在C#中检查损坏的TIFF图像? - 堆栈溢出 [ ^ ]



希望,它有帮助:)
Although I haven't tried this, your question seems to have an answer in following threads. Please check and see if these help-
Read image and determine if its corrupt C# - Stack Overflow[^]
How do I check for corrupt TIFF images in C#? - Stack Overflow[^]

Hope, it helps :)


这篇关于使用.NET查找损坏的tiff文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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