public void saveImageExistingMultiplePage(Image origionalFile, string type, int PageNumber, string location,long col1,float dpi) { //Now load the Codecs ImageCodecInfo codecInfo = getCodecForstring(type); EncoderParameter SaveEncodeParam; EncoderParameter CompressionEncodeParam; EncoderParameters EncoderParams = new EncoderParameters(3); EncoderParameter ColorEncodeParam; Bitmap pages; Bitmap NextPage; origionalFile.SelectActiveFrame(FrameDimension.Page, 0); pages = new Bitmap(origionalFile); pages = ConvertToBitonal(pages,dpi); // Save the first page (frame). SaveEncodeParam = new EncoderParameter(System.Drawing.Imaging.Encoder.SaveFlag, (long)EncoderValue.MultiFrame); CompressionEncodeParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Compression, (long)EncoderValue.CompressionNone); // Save the image with a color depth of 24 bits per pixel. ColorEncodeParam = new EncoderParameter(System.Drawing.Imaging.Encoder.ColorDepth, col1); EncoderParams.Param[0] = CompressionEncodeParam; EncoderParams.Param[1] = SaveEncodeParam; EncoderParams.Param[2] = ColorEncodeParam; pages.Save(location, codecInfo, EncoderParams); for (int i = 1; i < PageNumber; i++) { SaveEncodeParam = new EncoderParameter(System.Drawing.Imaging.Encoder.SaveFlag, (long)EncoderValue.FrameDimensionPage); CompressionEncodeParam = new EncoderParameter(System.Drawing.Imaging.Encoder.Compression, (long)EncoderValue.CompressionNone); EncoderParams.Param[0] = CompressionEncodeParam; EncoderParams.Param[1] = SaveEncodeParam; EncoderParams.Param[2] = ColorEncodeParam; origionalFile.SelectActiveFrame(FrameDimension.Page, i); NextPage = new Bitmap(origionalFile); NextPage = ConvertToBitonal(NextPage,dpi); pages.SaveAdd(NextPage, EncoderParams); } SaveEncodeParam = new EncoderParameter(System.Drawing.Imaging.Encoder.SaveFlag, (long)EncoderValue.Flush); EncoderParams.Param[0] = SaveEncodeParam; pages.SaveAdd(EncoderParams); } public int getPageNumber(Image img) { Guid objGuid = img.FrameDimensionsList[0]; FrameDimension objDimension = new FrameDimension(objGuid); //Gets the total number of frames in the .tiff file int PageNumber = img.GetFrameCount(objDimension); return PageNumber; }