如何编辑乘法tiff?
i写了一些东西是为了从乘法tiff文件中提取单个页面。
// Load as Bitmap
using (Bitmap bmp = new Bitmap(file))
{
// Get pages in bitmap
int frames = bmp.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);
bmp.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, tiffpage);
if (bmp.PixelFormat != PixelFormat.Format1bppIndexed)
{
using (Bitmap bmp2 = new Bitmap(bmp.Width, bmp.Height))
{
bmp2.Palette = bmp.Palette;
bmp2.SetResolution(bmp.HorizontalResolution, bmp.VerticalResolution);
// create graphics object for new bitmap
using (Graphics g = Graphics.FromImage(bmp2))
{
// copy current page into new bitmap
g.DrawImageUnscaled(bmp, 0, 0);
// do whatever you migth to do
...
}
}
}
}
错误:无法从具有索引像素格式的图像创建图形对象。...与它是乘法无关。 索引图像格式意味着它具有颜色的调色板,例如这是一个256色的图像。 1位图像(B&W)也可以算作具有2个色板。
您无法对使用调色板的图像进行操作,需要首先将它们转换为15位或更多颜色深度。
http://www.codeproject.com/kb/gdi-plus/bitonalimageconverter.aspx
i曾经写过很少的实用程序来从TIFF图像中创建加密的PDF。这是从TIFF映像中获取页面的一件代码:
Graphics