Hello,
I am having issues controlling the quality of Tiff files generated from Aspose.word.
The situation:
Our clients provide us word documents, which we currently use MS office automation to print to an image printer which is then faxed to our clients distribution lists.
The problem, we are wanting to cease our dependency on office and the image printer and find a way of converting straight from word to tiff.
I am however having issues controlling the black and white image quality of the generated tiff file. Basically it appears there is no grayscale whatsoever in the generated tiff file. its either black or white.
This isnt acceptable to our clients as by printing to the image printer does give us “shading” Perhaps i am overlooking a setting, perhaps i need to experiment with a DPI value, but so far, im not having any luck.
The code:
Dim wdoc As New Document(strPath + strFile + "." + strFileExt)
Dim options As New ImageSaveOptions(SaveFormat.Tiff)
options.ImageColorMode = Aspose.Words.Saving.ImageColorMode.Grayscale '0=colour, 1=Greyscale, 2=Black and white
options.TiffCompression = Aspose.Words.Saving.TiffCompression.Ccitt4
options.Resolution = 204
options.UseAntiAliasing = True
options.ImageContrast = 0.2
options.UseHighQualityRendering = True
wdoc.Save(strOutputFile, options)
Any opinions or ideas appreciated.
Thanks.
Hi Andrew,
Thanks for your inquiry. The problem occurs because when you use TiffCompression.Ccitt4 or TiffCompression.Ccitt3, 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 TiffCompression.Lzw or TiffCompression.Rle compressions. I hope, this helps.
Best regards,
Thankyou for the reply.
But we use the tif files for an automated fax service.
Currently we use MSOffice automation to print to a image printer, which yields us a tiff file of CCITT T4 format, at around 204x196 dpi resolution.
The images are not color images, but heavily pixelated black and white images to give us some “shading” and an overall better quality for our fax clients.
Now I have tested aspose printing to a image printer, and all works fine.
I have also saved as PDF and then converted from PDF to tiff using websupergoo, and that’s a very good result also.
I would prefer however, to bypass both methods entirely and go right from doc to tiff. The quality is however what is hindering me at this point.
I can provide document samples if required.
Thanks again,
Andrew.
Hi Andrew,
Thanks for the additional information. Please attach your 1) sample Word documents, 2) Aspose.Words generated output TIFF which shows the undesired behavior, 3) source code you used to generate this TIFF and 4) expected TIFF i.e. generated using MSOffice automation here for testing. We will investigate the issue further on our end and provide you more information.
Best regards,
The code is rough code to test a very simple conversion, but:
Public Sub CreateTiffUsingAspose_BlackAndWhite(ByVal strPath As String, ByVal strFile As String, ByVal strFileExt As String)
Dim strOutputFile As String
Dim sWatch As Stopwatch
sWatch = New Stopwatch()
sWatch.Start()
strOutputFile = strPath + strFile + "*aspose14.1_BLACKANDWHITE*" + strFileExt + ".tif"
Dim wdoc As New Document(strPath + strFile + "." + strFileExt)
Dim options As New ImageSaveOptions(SaveFormat.Tiff)
options.ImageColorMode = Aspose.Words.Saving.ImageColorMode.Grayscale '0=colour, 1=Greyscale, 2=Black and white
options.TiffCompression = Aspose.Words.Saving.TiffCompression.Ccitt3
options.Resolution = 204
options.UseAntiAliasing = True
options.ImageContrast = 0.2
options.UseHighQualityRendering = True
wdoc.Save(strOutputFile, options)
sWatch.Stop()
wdoc = Nothing
End Sub
The attached documents are from the resulting conversion as well as the desired result.
Thanks again,
Andrew
Hi Andrew,
Thanks for your inquiry. We are working over your query and will get back to you soon.
Best regards,
Hi Andrew,
Thanks for your inquiry. To address this problem, I have logged a new issue in our bug tracking system. The ID of your issue is WORDSNET-9756. Your request has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.
Best regards,
Hi Andrew,
Thanks for being patient. Please use the ImageSaveOptions.TiffBinarizationMethod property to fulfil your requirement as follows:
Dim doc As New Document("C:\Temp\TestDoc1.doc")
Dim so As ImageSaveOptions = New ImageSaveOptions(SaveFormat.Tiff)
so.TiffCompression = TiffCompression.Ccitt4
so.TiffBinarizationMethod = ImageBinarizationMethod.FloydSteinbergDithering
so.Resolution = 300
doc.Save("C:\Temp\out.tiff", so)
Best regards,