Save Multipage Tiff
Posted: Thu Oct 22, 2009 8:34 am
Hi,
I want to load an multipage Tiff and split this image in multi page tiff. (Example : I have a 100 pages tiff, I want to divided this into 10 files each file contains 10 pages.)
My Problem is that If I put a messagebox after one file saved then it is working fine. But if I ommit the message box it is generating multipage tiff.
I am using demo version.
Here is my sample code:
Please help.
This is very urgent.
With Thanks,
Tapas
I want to load an multipage Tiff and split this image in multi page tiff. (Example : I have a 100 pages tiff, I want to divided this into 10 files each file contains 10 pages.)
My Problem is that If I put a messagebox after one file saved then it is working fine. But if I ommit the message box it is generating multipage tiff.
I am using demo version.
Here is my sample code:
Code: Select all
_tiff = new TiffFile(openFileDialog1.FileName);
outputFileName = sourceDirectory + splitFolder + "\\" + firstIndex.ToString()+ ".tif";
EncoderBase encoder = AvailableEncoders.FindEncoder(outputFileName);
VintasoftImage image1 = new VintasoftImage();
((TiffEncoder)encoder).CreateNewFile = true;
((TiffEncoder)encoder).Compression = TiffCompression.JPEG;
ImageCollection images = new ImageCollection();
images.ImageSaving += new ImageSavingEventHandler(images_ImageSaving);
images.ImageSaved += new ImageSavedEventHandler(images_ImageSaved);
for (int i = firstIndex; i <= lastIndex; i++)
{
images.Add(_tiff.Pages[i].GetImage());
}
images.Save(outputFileName, (TiffEncoder)encoder);
// MessageBox.Show("ok");
this.label1.Text = barcodeValue + ".tif saved Successfully";
// System.Threading.Thread.SpinWait(5000);
//System.Threading.Thread test = System.Threading.Thread.CurrentThread;
images.Dispose();
images = null;
This is very urgent.
With Thanks,
Tapas