Welcome Guest! To enable all features, please Login or Register.



Last Go to last post Unread Go to first unread post
#1 Posted : Monday, July 16, 2018 4:48:46 AM(UTC)


Groups: Registered
Posts: 10

Thanks: 1 times

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;
//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);
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);

Any idea what is wrong?

thanks a lot


Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Monday, July 16, 2018 7:44:45 AM(UTC)


Groups: Registered
Posts: 10

Thanks: 1 times

Found the Error :-)

The Problem was RasterSizeFlags and CodecsLoadByteOrder.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2023, Yet Another Forum.NET
This page was generated in 0.056 seconds.