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

Free Support Forum - aspose.com

Converting TXT file to tiff image

Hi Team,

We have a scenario where when we send txt document as attachment in mail the tiff image which is obtained for the email body contains the attachment content as well ,please find the screen shot below

image.png (2.3 KB)

we are using aspose version 19.9

Could you please share a code snippet or simple project that can be used for reproducing the problem and investigating the issue? Also, we need all the necessary files.

Hi ,

I have uploaded the attachment used for conversion,my requirement was when the application receive the mail it needs to convert the email body as a tif and attachment as another tiff ,however here the email body tiff image has attachment content as well

Please find the code snippet used to convert .msg file to tiff

public static void ConvertMSGToTiff(string OutputFolder, string FullInputFileName)
//output folder is where the converted tiff get saved and file name is the .msg file name
MemoryStream msgStream = null;
MailMessage msg = null;
Document msgDocument = null;

        string TiffFileName = string.Empty;

        {<a class="attachment" href="/uploads/discourse_instance3/48123">TestDocument.zip</a> (170 Bytes)

            string FullconvertedMultiTiffName = string.Empty;
            // load the MSG file using Aspose.Network for .NET
            msg = MailMessage.Load(FullInputFileName, MessageFormat.Msg);
            msgStream = new MemoryStream();
            msg.Save(msgStream, MailMessageSaveType.MHtmlFromat);
            FullconvertedMultiTiffName = Path.Combine(OutputFolder, "MSGFile.tiff");
            msgStream.Position = 0;
            // load the MHTML stream using Aspose.Words for .NET
            LoadOptions opt = new LoadOptions();
            opt.LoadFormat = LoadFormat.Mhtml;
            msgDocument = new Document(msgStream);
            foreach (Shape shape in msgDocument.GetChildNodes(NodeType.Shape, true))



            ImageSaveOptions options = new ImageSaveOptions(Aspose.Words.SaveFormat.Tiff);
            options.ImageColorMode = ImageColorMode.None;
            options.PageIndex = 0;  //enter the value of your choice
            options.Resolution = 0; //enter the value of your choice
            options.PageCount = msgDocument.PageCount;
            options.ImageBrightness = .00f; //enter the value of your choice
            options.TiffCompression = TiffCompression.None;
                            msgDocument.Save(OutputFolder, options);
        catch (Exception ex)

            throw ex;

            if (msgStream != null)

            if (msg != null)
                msg = null;
            if (msgDocument != null)
                msgDocument = null;


To my regret, we cannot compile your code snippet. Could you please share a simple standalone project for investigating the issue?
Also, your TestDocument.zip file has not been uploaded, please try again.