I have the original bytes for the image. I use the following for code to determine if an image is corrupt or not.
public bool IsValidGDIPlusImage(byte[] imageData)
{
try
{
using (var ms = new MemoryStream(imageData))
{
using (var bmp = new Bitmap(ms))
{
}
}
return true;
}
catch (Exception ex)
{
return false;
}
}
If the image is completely damaged, the above code works fine, but what if I have an image that is partially damaged? Like jpeg below

How to determine if an image is partially damaged?
The original image, under which there is a simple image 300 × 300 in size with a diagonal line from the center.
Any guidance is much appreciated. Thanks
user349026
source
share