We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image color is changed after RTF to TIFF conversion using C#

I am attempting to convert an RTF to a TIFF using Aspose.Words.

The RTF is passed in as a byte array and the following is then called

var inputStream = new MemoryStream(doc);
int total = aspose.ConvertToImage(inputStream, outputStream, startPage, count);

If I then save the outputstream it is a TIFF with the correct data but the image is inverted (white text on a black background).

I will attach the input and output files.

Thanks for any help.
Neil

    public int ConvertToImage(Stream inputStream, Stream outputStream, int fromPage, int pageCount)
    {
        var doc = new Document(inputStream);
        var saveOpts = new ImageSaveOptions(SaveFormat.Tiff)
        {
            Resolution = 200,
            TiffBinarizationMethod = ImageBinarizationMethod.Threshold,
            TiffCompression = TiffCompression.Rle,
            UseAntiAliasing = false,
            UseHighQualityRendering = false,
            MemoryOptimization = true,
        };

        if (fromPage != 0)
            saveOpts.PageIndex = fromPage;
        if (pageCount != 0)
            saveOpts.PageCount = pageCount;

        doc.Save(outputStream, saveOpts);
        outputStream.Seek(0, SeekOrigin.Begin);
        return doc.PageCount;
    }

AsposeIssue.zip (4.7 KB)

@NT123

We have tested the scenario using the latest version of Aspose.Words for .NET 20.1 and have not found the shared issue. So, please use Aspose.Words for .NET 20.1. We have attached the output TIFF file with this post for your kind reference. 20.1_tiff.zip (6.9 KB)

Thank you for your response.

We are using v20.1.0. We are running this under .NET Standard 2.0.

Regards
Neil

@NT123

Could you please share your working environment on which you are facing this issue? We will investigate the issue on same environment and provide you more information on it.

@NT123

We have tested the scenario using .NET Standard 2.0. and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-19954 . You will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

Thank you for your quick response.

Do you have any timescales for when the issue would be resolved?

Regards
Neil

@NT123

We try our best to deal with every customer request in a timely fashion, we unfortunately cannot guarantee a delivery date to every customer issue. We work on issues on a first come, first served basis. We feel this is the fairest and most appropriate way to satisfy the needs of the majority of our customers.

Currently, your issue is pending for analysis and is in the queue. Once we complete the analysis of your issue, we will then be able to provide you an estimate.

The issues you have found earlier (filed as WORDSNET-19954) have been fixed in this Aspose.Words for .NET 20.3 update and this Aspose.Words for Java 20.3 update.