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

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, July 20, 2018 2:57:28 AM(UTC)

krekar  
krekar

Groups: Registered
Posts: 7

Thanks: 2 times

Hi.

How can I save multi-page TIFF?

First, I read the multi-page TIFF successfully.
And Process loaded bitmap on each page, then save it another multi-page TIFF.

But can't save multi-page TIFF.
My source code is below...
What is my mistake in save code(Line #27).

Code:

L_INT ret;
LFile r_file;
FILEINFO r_fileinfo;
memset(&r_fileinfo, 0, sizeof(FILEINFO));

r_file.SetFileName(string_to_TCHAR(input_file_path.string()));
ret = r_file.GetInfo(&r_fileinfo, sizeof(FILEINFO));
if (ret == SUCCESS)
{
	std::cout << "Name : " << input_file_path.filename().string() << std::endl;

	std::cout << "Format : " << r_fileinfo.Format << std::endl;
	std::cout << "Page count : " << r_fileinfo.TotalPages << std::endl;

	for (int page_idx = 0; page_idx < r_fileinfo.TotalPages; page_idx++)
	{
		LBitmapBase bitmap;
		ret = bitmap.Load(string_to_TCHAR(input_file_path.string()), 0, ORDER_BGRORGRAY, page_idx, NULL);
		std::cout << "Load ret : " << ret << std::endl;

		std::cout << "Page : " << page_idx << std::endl;
		std::cout << "BPP : " << bitmap.GetBitsPerPixel() << std::endl;
		std::cout << "Order : " << bitmap.GetColorOrder() << std::endl;

		// TODO Process...

		ret = bitmap.Save(string_to_TCHAR(output_file_path.string()), r_fileinfo.Format, 0, get_quailty_factor(r_fileinfo.Format), page_idx, 0);
		std::cout << "Save ret : " << ret << std::endl;
	}
}



Thanks.


 

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 : Friday, July 20, 2018 3:34:57 AM(UTC)

krekar  
krekar

Groups: Registered
Posts: 7

Thanks: 2 times

I solved a issue myself...

My mistake is page index number.

The page index must start at 1. But my code is start at 0.

I change the for-loop to "for (int page_idx = 1; page_idx <= r_fileinfo.TotalPages; page_idx++)", then solved it.

Thanks.
 
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-2024, Yet Another Forum.NET
This page was generated in 0.056 seconds.