Free Support Forum - aspose.com

Embedded image is too dark

I am using the following code (simplified to illustrate the problem) to embed an image into a Word doc:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertImage(@“C:\image_jptmn1q3.tif”);
doc.Save(@“c:\test_doc.doc”, SaveFormat.Doc);

This works fine except when I use 16bit colour tiff images (see the attached image). This image displays fine if I use Word to view it. When I view the doc created using the above code though the image is very dark.

Any ideas whats wrong?

Thanks,

Andy

Hi

Thanks for your request. Try to use the following code to solve your problem.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

Image img = Image.FromFile(@"166_93584_Andy12345\image_jptmn1q3.tif");

Stream imageStream = new MemoryStream();

img.Save(imageStream, ImageFormat.Jpeg);

builder.InsertImage(imageStream);

doc.Save(@"166_93584_Andy12345\out.doc");

I hope that it will help you.

Best regards.

Thanks for your reply.

Is there any way to do this without converting the image to a jpeg? We do not want to loose any quality in the image (thats why we use tiffs).


Thanks,

Andy

Hi

This is known problem. It is present in our defect database as issue # 703. We works on this issue.

Best regards.

The issues you have found earlier (filed as WORDSNET-425) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.