We have legacy applications built using VB6. These applications are using lead-tools. Everything was perfectly working. We have another .NET process that optimizes the image (and do some water-marking) and save it in tiff format. Here is glimpse of .NET code,
using (var bitmap = new Bitmap(contractWidth, contractHeight))
{
using (var canvas = Graphics.FromImage(bitmap))
{
canvas.InterpolationMode = InterpolationMode.Default;
// Play with canvas
canvas.Save();
}
using (var stream = new MemoryStream())
{
bitmap.Save(stream, ImageFormat.Tiff);
return stream.ToArray();
}
}
When we save this in tiff format (say image.tif). But when we open this file on our VB6 project, it shows a blue screen. I tried to compare the image which is working and image which is not working. Here are screens,
Working:
Not Working:
Update: This fixed my issue Convert TIFF to 1bit
I know you found a solution to the problem by converting the input image to 1-bit, but I wanted to elaborate more on the cause of the original problem, which is LEADTOOLS not opening the 32-bit file correctly in the first place.
You haven't specified which version of LEADTOOLS you're using, but since it's a legacy VB6 application, it's probably a rather old version (somewhere between v10 and v17; the current version is 20).
In any case, even older versions of the SDK should have no problem opening 32-bit TIFF files, but your application might be missing one or both of the following requirements:
Different sub-types of TIFF files require different LEADTOOLS DLLs. This is explained in the help topic Files to be Included with Your Application.
Older versions of the SDK required a special license to support LZW compression, back in the days when there was an active patent on LZW. If you're using one of these versions AND your application does not have that license, it won't support LZW tiff or gif files.
Please note that even owners of older SDK versions get free support. So if you are the owner of the original SDK, feel free to email any questions to support@leadtools.com, along with your LEADTOOLS product serial number.
来源:https://stackoverflow.com/questions/52299045/image-created-using-gdi-is-not-showing-in-vb6-leadtools