GdPicture.NET如何为TIFF文件添加页

作者:控件中国网   出处:控件中国网   2016-09-06 11:15:58   阅读:4

GdPicture.NET为开发人员提供了编辑和处理TIFF文件的功能,对于TIFF文件,可以通过控件提供的API函数TiffSaveAsMultiPageFile保存单页的TIFF文件为多页的,然后再通过TiffAddToMultiPageFile函数来为多页TIFF文件添加页,具体的使用方法可以参考下面的详细代码:
GdPictureImaging oGdPictureImaging = new GdPictureImaging();
int ImageID = 0;
int TiffID = 0;
ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("image1.tif");
oGdPictureImaging.TiffSaveAsMultiPageFile(ImageID, "multipage.tif", TiffCompression.TiffCompressionAUTO);
//At this step ImageID1 handles a reference to the multipage tiff stream.
TiffID = ImageID;
//adding a second page in the multipage stream from image2.tif
ImageID = oGdPictureImaging.CreateGdPictureImageFromFile("image2.tif");
oGdPictureImaging.TiffAddToMultiPageFile(TiffID, ImageID);
oGdPictureImaging.ReleaseGdPictureImage(ImageID);
oGdPictureImaging.ReleaseGdPictureImage(ImageID);
oGdPictureImaging.TiffCloseMultiPageFile(TiffID); //end the file
oGdPictureImaging.ReleaseGdPictureImage(TiffID); //releasing the input bitmap from the memory
 
注意上面的image1.tif在这里必须是单页的TIF文件,如果是多页的,那么就会造成TiffAddToMultiPageFile函数无法添加页。
Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat