Word to Tiff is not accepting the PixelFormat

Hi In below code we have tried all kind of available PixelFormat but it seems Aspose is reseting it by their own.

Aspose.Words.Document wrdf;

Aspose.Words.Loading.LoadOptions loadOption = new Aspose.Words.Loading.LoadOptions();
loadOption.LoadFormat = Aspose.Words.LoadFormat.Text;
wrdf = new Aspose.Words.Document(fileDetail.FileInfo.FullName, loadOption);
Aspose.Words.Saving.ImageSaveOptions saveOptions = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Tiff);
saveOptions.PixelFormat = Aspose.Words.Saving.ImagePixelFormat.Format1bppIndexed;


saveOptions.TiffCompression = Aspose.Words.Saving.TiffCompression.Lzw;
saveOptions.Resolution = 300;
saveOptions.SaveFormat = Aspose.Words.SaveFormat.Tiff;
wrdf.Save(fileDetail.OutputPath, saveOptions);

We are stuck now as Our file size is high due to that. It only accept 24 and 32. We need to set BitDepth of tiff image.
What ever value we put it convert to 24 or 32 Bit.
We need a quick solution of this.

@atyagi39,

Please note that ImageSaveOptions.PixelFormat property has effect only when saving to raster image formats. The default value is Format32BppArgb. Pixel format of the output image may differ from the set value because of work of GDI+. However, can you please ZIP and upload your source Word document (that you are getting this problem with) here for testing? We will then investigate the scenario further on our end and provide you more information.

This is really a nice explanation of the issue.
But for your information I am just converting a plain text file to tiff.
PixelFormat is not working there as well. try any text file and you will see the issue.
I have many text file where its behaving the same.
BTW text file is attached here 15.zip (218 Bytes)

If there is any way to convert text file to have a defined PixelDepth please let me know.

@atyagi39,

We have logged this problem in our issue tracking system. Your ticket number is WORDSNET-22877. We will further look into the details of this problem and will keep you updated here on the status of the linked ticket. We apologize for your inconvenience.

Do you have any status on this? We are waiting for a reply asap. We are stuck.

@atyagi39 Unfortunately, there is no news about this issue. Please spare us some time for analysis. Once there are any news we will will you know.

@atyagi39 Our developers have completed analyzing the issue.
Since we are using GDI +. It independently changes the transmitted PixelFormat. Unfortunately, we cannot influence this.
But to change the file size and BitDepth. You can try other compressions.
For example, using the following settings for the file from the task:

saveOptions.PixelFormat = ImagePixelFormat.Format1bppIndexed;
saveOptions.TiffCompression = TiffCompression.Ccitt3;
saveOptions.Resolution = 300;
saveOptions.SaveFormat = SaveFormat.Tiff;

the code produces the following output:
BitDepth = 1
OutFileSize = 17KB

and for

saveOptions.TiffCompression = TiffCompression.Ccitt4;

it produces:
BitDepth = 1
OutFileSize = 3KB

Please let us know if the proposed solution is acceptable for you, then we will close the issue.

Hi this is my requirement due to some legislation that it should be in LZW and resolution should be 300 and Bit depth should not be more than 8. So I don’t know why you are saying GD+ how GD+ help when it changes different compression.
We really need a solution or workaround.
We can’t use your solution else.

@atyagi39 Thank you for additional information. We will continue investigating this issue and provide you more information.

Hi,

Any update on this?

@atyagi39 The issue is planned to be resolved before 21.12 release. But please note this is an approximate estimate.

The issues you have found earlier (filed as WORDSNET-22877) have been fixed in this Aspose.Words for .NET 21.12 update also available on NuGet.