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 : Monday, August 14, 2006 7:37:37 AM(UTC)

derekp  
derekp

Groups: Registered
Posts: 2


I have to start a job where I process multimage TIFFs (as well as modca's) and must simply split them up to single image per file output. I've written some small sample code to do that and it seems to work ok. (My output is always TIFF G4)
A new wrinkle crept in on me - I recently learned that if the input TIFF (does not apply to modca) has any color images in it, I must write the output back out as a color image (though I'm not yet sure what TIFF format to use, probably TIF_JPEG_411)
Heres where I have some problems....
I believe I must examine each image to see if ANY of my images contain color so I can switch my output format - am I correct in this thinking?
Or is there some flag I can examine when I first open the file that will tell me if I'm dealing with color or B&W (most of my images are B&W only)

I'm using raster imaging pro and working in C
My current test code looks something like this (for B&W)
=================
            nRet = L_GetDefaultLoadFileOption(&lfo, sizeof(LOADFILEOPTION));
            // For each page: Load Page -> Save Page
            for(int i = 0; i < fi.TotalPages; i++)
            {
                // load each page and write it out
                lfo.PageNumber = i + 1;
                nRet = L_LoadBitmap(szLoadName, &bmp, sizeof(BITMAPHANDLE), 0, 0, &lfo, NULL);
                if(!DisplayError(nRet, "L_LoadBitmap"))
                {
                    // Create FileName and Save Page
                    sprintf(szSaveName, "..\\Outputs\\%s_%d.tif", szLoadName,i);
                    nRet = L_SaveBitmap(szSaveName, &bmp, FILE_CCITT_GROUP4, 1, 0, NULL);
                    DisplayError(nRet, "L_SaveBitmap");
                    // Free Page
                    L_FreeBitmap(&bmp);
                }
            }   
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 : Tuesday, August 15, 2006 6:30:11 AM(UTC)

Bashar  
Guest

Groups: Guests
Posts: 3,034

Was thanked: 2 time(s) in 2 post(s)

You are correct, if the input TIFF file has a color image then you need to save as a color image to maintain the colors.

You can call L_FileInfo to find out the compression of the input TIFF file.  You can simply save it with this same format to make sure you maintian the color information.  You can also use L_GetBitmapColorCount to find out how many colors the bitmap contains.

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