I am facing the same proble. My requirement is that .tiff files are stored on server and I am getting it in byte[] one by one. How to combing all the fiff files into single one and disay pn screen ? I have a solution that Iam ablle to save it on local machine
and I can display it/download it. But I don't want to save it on local hard drive insteat of I want to store it in memory and then there I want to display it.
option Save it on local maching code:
Using FreeImageBitmap object of FreeImageAPI, C#
//Tiff file data is getting in byte[], e.g document(o), document(1), document(3)
internal void DocumentTiff(Proxy.Document document)
{
int fileCount = document.files.Length;
FreeImageBitmap myTiff = new FreeImageBitmap(0, 0);
string FilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),"Downloads") + "\\";
//string FilePath = Path.GetTempPath();
Random random = new Random();
int randomNumber = random.Next(0, 100);
string sFileName = FilePath + randomNumber + document.attribute.documentID + ".tif";
myTiff.Save(sFileName);
//IF I save it in MemoryStream but getting error myTiff.SaveAdd(tPage, i) as you first Complete Save() option
//MemoryStream stream = new MemoryStream();
//myTiff.Save(stream, FREE_IMAGE_FORMAT.FIF_TIFF);
for (int i = 0; i < fileCount; i++)
{
MemoryStream ms = null;
FreeImageBitmap tPage = null;
try
{
ms = new MemoryStream(document.files[i].data, true);
ms.Position = 0;
tPage = new FreeImageBitmap(ms);
myTiff.SaveAdd(tPage, i); // If I am using MemoryStream then it thows exception Complete fisrt SAVE()
}
catch (Exception Ex)
{
throw;
}
finally
{
ms.Close();
tPage.Dispose();
}
}
if (myTiff != null)
{
//Procedure is used to Download/Save dialog box option
this.Files.Add(new FileNetFile(sFileName));
}
}
mvilaskumar1
Member
4 Points
6 Posts
Combine/Merge Multiple .tif files into a single .tif file using MemoryStream
Jan 30, 2013 03:26 PM|LINK
Hi All,
I am facing the same proble. My requirement is that .tiff files are stored on server and I am getting it in byte[] one by one. How to combing all the fiff files into single one and disay pn screen ? I have a solution that Iam ablle to save it on local machine and I can display it/download it. But I don't want to save it on local hard drive insteat of I want to store it in memory and then there I want to display it.
option Save it on local maching code:
Using FreeImageBitmap object of FreeImageAPI, C#
//Tiff file data is getting in byte[], e.g document(o), document(1), document(3)
internal void DocumentTiff(Proxy.Document document)
{
int fileCount = document.files.Length;
FreeImageBitmap myTiff = new FreeImageBitmap(0, 0);
string FilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),"Downloads") + "\\";
//string FilePath = Path.GetTempPath();
Random random = new Random();
int randomNumber = random.Next(0, 100);
string sFileName = FilePath + randomNumber + document.attribute.documentID + ".tif";
myTiff.Save(sFileName);
//IF I save it in MemoryStream but getting error myTiff.SaveAdd(tPage, i) as you first Complete Save() option
//MemoryStream stream = new MemoryStream();
//myTiff.Save(stream, FREE_IMAGE_FORMAT.FIF_TIFF);
for (int i = 0; i < fileCount; i++)
{
MemoryStream ms = null;
FreeImageBitmap tPage = null;
try
{
ms = new MemoryStream(document.files[i].data, true);
ms.Position = 0;
tPage = new FreeImageBitmap(ms);
myTiff.SaveAdd(tPage, i); // If I am using MemoryStream then it thows exception Complete fisrt SAVE()
}
catch (Exception Ex)
{
throw;
}
finally
{
ms.Close();
tPage.Dispose();
}
}
if (myTiff != null)
{
//Procedure is used to Download/Save dialog box option
this.Files.Add(new FileNetFile(sFileName));
}
}
bbcompent1
All-Star
32984 Points
8500 Posts
Moderator
Re: Combine/Merge Multiple .tif files into a single .tif file using MemoryStream
Jan 30, 2013 03:34 PM|LINK
Have you checked out this thread here: http://forums.asp.net/t/1447100.aspx specifically this post: http://forums.asp.net/post/3296182.aspx
mvilaskumar1
Member
4 Points
6 Posts
Re: Combine/Merge Multiple .tif files into a single .tif file using MemoryStream
Jan 31, 2013 01:25 AM|LINK
I tried code from this link http://forums.asp.net/post/3296182.aspx
but not sure whats is this function
Image imgTif = Image.FromStream(tifsStream[0]);
long imgCompression = GetCompression(imgTif);
bbcompent1
All-Star
32984 Points
8500 Posts
Moderator
Re: Combine/Merge Multiple .tif files into a single .tif file using MemoryStream
Jan 31, 2013 12:46 PM|LINK
That is about the encoder compression.