3
단일 티파니를 다중 페이지 티파니에 결합하는 코드를 작성합니다. 출력은 빈 페이지가 끝에옵니다. 입력 파일이 검은 색일 경우 코드가 올바르게 작동합니다. & 흰색이지만 색이있는 .tiff 파일은 아닙니다. 예를 들어 내가 100 개의 파일을주고 입 출력으로 하나의 tiff 파일이 47 페이지로 나오면 나머지는 비어 있습니다.다중 페이지 티프 프로그램 빈 페이지
표준 코드를 사용하여이 기능을 수행하려면 다음을 수행하십시오. 왜 그런 생각이 들지?
using (FileStream fs = new FileStream(fileNameTemp, FileMode.Append, FileAccess.Write))
{
System.Windows.Media.Imaging.TiffBitmapEncoder tifEnc = new System.Windows.Media.Imaging.TiffBitmapEncoder();
tifEnc.Compression = System.Windows.Media.Imaging.TiffCompressOption.Default;
foreach (string fileName1 in filePaths)
{
Console.WriteLine("FileName:::" + fileName1);
System.Windows.Media.Imaging.BitmapImage bmpImg = new System.Windows.Media.Imaging.BitmapImage();
bmpImg.BeginInit();
bmpImg.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad;
bmpImg.UriSource = new Uri(fileName1);
bmpImg.EndInit();
System.Windows.Media.Imaging.FormatConvertedBitmap fcb = new System.Windows.Media.Imaging.FormatConvertedBitmap(bmpImg,
System.Windows.Media.PixelFormats.Rgb24,
System.Windows.Media.Imaging.BitmapPalettes.Halftone27,
1.0);
tifEnc.Frames.Add(System.Windows.Media.Imaging.BitmapFrame.Create(fcb));
}
tifEnc.Save(fs);
fs.Dispose();
}
미리 감사드립니다.