Hi,
I am working in a project to transform stream (jpg,gif,bmp,png) to tiff image, but I have found an issue with the BMP file type, the JPG and GIF file types are working as expected. The source code I am using is the folllowing:
LogMessage("DEBUG: ", “STEP1: Start the imaging trans.”);
System.IO.MemoryStream tmpMemStream = null;
tmpMemStream = new System.IO.MemoryStream(this.FileBytes.Length);
tmpMemStream.Write(this.FileBytes, 0, this.FileBytes.Length);
LogMessage("DEBUG: ", “STEP2: Stream assigned”);
string filetype = Aspose.Imaging.Image.GetFileFormat(tmpMemStream).ToString();
LogMessage("DEBUG: ", "FILETYPE: " + filetype);
Aspose.Imaging.Image imgInput = Aspose.Imaging.Image.Load(tmpMemStream);
LogMessage("DEBUG: ", “STEP3: stream loaded to aspose imaging.”);
MemoryStream outputStream = new MemoryStream();
imgInput.Save(outputStream, new Aspose.Imaging.SaveOptions.TiffSaveOptions());
LogMessage("DEBUG: ", “STEP4: stream transformed.”);
byte[] ConvertedBytes = null;
ConvertedBytes = outputStream.ToArray();
The log file report this:
[2012-01-03 11:56:19.1911] -1 4 DEBUG:Going to ImageAttachment.cs file. .bmp
[2012-01-03 11:56:21.9568] -1 4 DEBUG: STEP1: Start the imaging trans.
[2012-01-03 11:56:21.9568] -1 4 DEBUG: STEP2: Stream assigned
[2012-01-03 11:56:22.0193] -1 4 DEBUG: FILETYPE: Bmp
[2012-01-03 11:56:22.0349] -1 4 Error with convert to tiff:Object reference not set to an instance of an object.
[2012-01-03 11:56:22.0349] -1 4 Error with load for convert:Error with load for convert:Object reference not set to an instance of an object.
I really appreciate if you can take a look on this.
Thank you,
Danilo Ac
This message was posted using Page2Forum from Saving Image files - Aspose.Imaging for .NET