Hi all!
I'm using Lead Tools V17.5 and trying to split a multipage tiff file and resize it to 400dpi.
When I load the image I got always the error "Invalid parameter passed", the File is a 1bit per pixel technical drawing with CCITT Group 4 compression.
String sourceFile = @"C:\TEMP\MP\Multipage.tif";
RasterCodecs codecs = new RasterCodecs();
CodecsImageInfo info = codecs.GetInformation(sourceFile, true);
string fNameBase = Path.GetFileNameWithoutExtension(sourceFile);
string filePath = Path.GetDirectoryName(sourceFile);
// Loop through the pages of the file; perform specific processing on it, then save each page to a separate file:
for (int pageNumber = 1; pageNumber <= info.TotalPages; pageNumber++)
{
//get information of each page
CodecsImageInfo pageInfo = codecs.GetInformation(sourceFile, true, pageNumber);
// Load the next image in the loop
int width = pageInfo.Width / pageInfo.XResolution * 400;
int height = pageInfo.Height / pageInfo.YResolution * 400;
pageInfo.Dispose();
//RasterImage image = codecs.Load(sourceFile,width, height,0,RasterSizeFlags.ScaleToGray,CodecsLoadByteOrder.Gray,pageNumber,pageNumber);
RasterImage image = codecs.Load(sourceFile, 0, CodecsLoadByteOrder.Gray, pageNumber, pageNumber);
SizeCommand size = new SizeCommand(width, height, RasterSizeFlags.ScaleToGray);
size.Run(image);
image.XResolution = 400;
image.YResolution = 400;
// Save the page to a separate file
string pageFileName = string.Concat(filePath, @"\", fNameBase, "_", pageNumber, ".TIF");
codecs.Save(image, pageFileName, RasterImageFormat.CcittGroup4, 0);
image.Dispose();
}
Any idea what is wrong?
thanks a lot
Christoph