#1
Posted
:
Friday, July 20, 2018 2:57:28 AM(UTC)
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.
#2
Posted
:
Friday, July 20, 2018 3:34:57 AM(UTC)
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.