Attached a file with a tif that doesn’t give an error/exception, but improperly generates a blank image.
private void convertTIFToPNG(string inputFilePath, string outputFilePath) {
var doc = new Aspose.Words.Document();
var builder = new Aspose.Words.DocumentBuilder(doc);
var shape = builder.InsertImage(inputFilePath);
shape.ImageData.Save(outputFilePath);
}
@kjpual The provided code does not actually convert TIFF to PNG. ImageData.Save method save the image data as is into the specified file, i.e. in your case the inserted TIFF image is saved with PNG extension. To actually convert TIFF to PNG you should use ShapeRenderer. Please see the following code:
private static void ConvertTIFToPNG(string inputFilePath, string outputFilePath)
{
var doc = new Aspose.Words.Document();
var builder = new Aspose.Words.DocumentBuilder(doc);
var shape = builder.InsertImage(inputFilePath);
shape.GetShapeRenderer().Save(outputFilePath, new ImageSaveOptions(SaveFormat.Png));
}
@kjpual There is a mistake in the code provide on this page. Please try using the code I have provide in the previous answer. I have tested on my side and TIFF is properly converted to PNG.
Thousands of other tif files convert fine. But this one (and 10s more) doesn’t, and it also doesn’t open in microsofts image viewer, unlike the other tifs.
@kjpual
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-26512
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.