Re: Grey coloured text disappears

I think the problem still exist (v 14.4.0.0). With LZW compression everything works fine but when switched to CCIT4 text with some colors are not converted. For example red works fine but gray not. Could you please confirm that and eventually provide some workaround?

Hi,

Thanks for your inquiry. Could you please attach your 1) input Word document, 2) output TIFF/Image file showing the undesired behavior and 3) source code you used to generate image here for testing? We will investigate the issue on our end and provide you more information.

Best regards,

Hello,

Please use following code to reproduce problem:

var wordSavingOptions = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Tiff);

wordSavingOptions.TiffCompression = Aspose.Words.Saving.TiffCompression.Ccitt4;
Aspose.Words.Document doc = new Aspose.Words.Document();

var grayParagraph = new Aspose.Words.Paragraph(doc);

Run headerPart = new Run(doc, "Gray Text");

headerPart.Font.Color = System.Drawing.Color.Gray;

headerPart.Font.Size = 20;

grayParagraph.AppendChild(headerPart);

doc.Sections[0].Body.Paragraphs.Add(grayParagraph);

var blackParagraph = new Aspose.Words.Paragraph(doc);

Run headerPart2 = new Run(doc, "Black Text");

headerPart2.Font.Size = 20;

headerPart2.Font.Color = System.Drawing.Color.Black;

blackParagraph.AppendChild(headerPart2);

doc.Sections[0].Body.Paragraphs.Add(blackParagraph);

ApplyDefaultMargin(doc);

doc.Save(@"c:\temp\test.tif", wordSavingOptions);

After execution only the black paragraph is visible.
Best Regards,

Hi,

Thanks for the additional information. The problem occurs because when you use TiffCompression.Ccitt4 the document is converted to black and white so some data may be lost, it’s the expected behaviour. To remedy this problem, you can use the following workaround:

var wordSavingOptions = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Tiff);
wordSavingOptions.TiffCompression = Aspose.Words.Saving.TiffCompression.Ccitt4;
wordSavingOptions.TiffBinarizationMethod = ImageBinarizationMethod.FloydSteinbergDithering;
Aspose.Words.Document doc = new Aspose.Words.Document();
var grayParagraph = new Aspose.Words.Paragraph(doc);
Run headerPart = new Run(doc, "Gray Text");
headerPart.Font.Color = System.Drawing.Color.Gray;
headerPart.Font.Size = 20;
grayParagraph.AppendChild(headerPart);
doc.Sections[0].Body.Paragraphs.Add(grayParagraph);
var blackParagraph = new Aspose.Words.Paragraph(doc);
Run headerPart2 = new Run(doc, "Black Text");
headerPart2.Font.Size = 20;
headerPart2.Font.Color = System.Drawing.Color.Black;
blackParagraph.AppendChild(headerPart2);
doc.Sections[0].Body.Paragraphs.Add(blackParagraph);
// ApplyDefaultMargin(doc);
doc.Save(@"c:\temp\test.tif", wordSavingOptions);

I hope, this helps.

Best regards,

Hello,

FloydSteinberg did the trick.
Thank’s for help!