1
我有一个多页图像abc.tiff
,我必须在每个页面上做一些绘图并将其保存为一个D:\xyz
位置的多页图像。如何从图像列表制作多页图像
我使用下面的代码为:
List<Image> images = new List<Image>();
Bitmap bitmap = (Bitmap)Image.FromFile(@"abc.tiff");
int count = bitmap.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);
for (int idx = 0; idx < count ; idx++)
{
bitmap.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, idx);
// save each frame to a bytestream
MemoryStream byteStream = new MemoryStream();
// below 3 lines for drawing something on image...
Bitmap tmp = new Bitmap(bitmap, bitmap.Width, bitmap.Height);
Graphics g = Graphics.FromImage(tmp);
g.DrawRectangle(blackPen, x, y, width, height);
tmp.Save(byteStream, System.Drawing.Imaging.ImageFormat.Tiff);
tmp.Dispose();
// and finally adding each frame into image list
images.Add(Image.FromStream(byteStream));
}
之后,我想,以节省D:\xyz
位置我改良的多页图像。
请问我可以如何从List<Image>
图片获得一个多页图片?
你解决了你的问题吗? – TaW 2014-09-09 13:55:15