Hello all,
I'm having an issue with images occasionally getting corrupted. I'm not sure sure if this is happening in the SaveAsTiff method or the CreateGdPictureImage method (from file), but I've attached a source copy and what returns when it's corrupted. It seems to happen about 1 in every 1000 times I save and load, has anyone seen this before?
Corrupted Image
Re: Corrupted Image
The corruption seems to occur in CreateGdPictureImageFromFile. Like I said, it works 99.9% of the time, but here is the code that has issues.
I've replaced that code block with the following block, and tested about 100,000 image loads without error. I'm not sure why this would work and the former doesn't, but that currently seems to be the case.
Code: Select all
public int GetGdPictureImage()
{
return gdPictureImaging.CreateGdPictureImageFromFile(this.cachePath);
}
Code: Select all
public int GetGdPictureImage()
{
using (FileStream fileStream = new FileStream(this.cachePath, FileMode.Open, FileAccess.Read))
{
byte[] bytes = new byte[fileStream.Length];
fileStream.Read(bytes, 0, bytes.Length);
return gdPictureImaging.CreateGdPictureImageFromByteArray(ref bytes);
}
}
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest