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 : Wednesday, June 27, 2007 1:25:49 PM(UTC)

RLenski  
RLenski

Groups: Registered
Posts: 12


I am trying to color only black pixels in a tif file.  It seems to work ok when I resize the bitmap in half, but when I try and paint the file without resizing, it just paints the whole file black.  I tried both Load() and LoadResize(), and all the functions return success, but the file is painted completely black.  I have attached the tif file I was testing with.  I am using Raster Pro, Version 14.5.  Thanks in advance of any help.  Here is my code:

  LBase::LoadLibraries(LT_ALL_LEADLIB);

  CString PageLocation = "C:\\Test\\Test.tif", NewPageLocation = "C:\\Test\\Test_NEW.tif";

  LFile        LeadFile;
  FILEINFO     fInfo;
  LBitmapBase * pBitmapBase = new LBitmapBase();

  LeadFile.SetFileName((L_TCHAR*)(LPCTSTR)PageLocation.GetBuffer(1));
  if( LeadFile.GetInfo(&fInfo, sizeof(FILEINFO)) == SUCCESS )
  {
   // This works
   //int LoadStatus = pBitmapBase->LoadResize((L_TCHAR*)(LPCTSTR)PageLocation.GetBuffer(1), fInfo.Width/2, fInfo.Height/2, 8, SIZE_NORMAL, ORDER_BGR, NULL, NULL);
   
   // This Doesn't
   int LoadStatus = pBitmapBase->LoadResize((L_TCHAR*)(LPCTSTR)PageLocation.GetBuffer(1), fInfo.Width, fInfo.Height, 8, SIZE_NORMAL, ORDER_BGR, NULL, NULL);

   if( LoadStatus == SUCCESS )
   {
    LBitmapRgn Region(pBitmapBase);
    int Status = Region.SetRgnColor(RGB(0,0,0)); // set the black color as a region
    if( pBitmapBase->HasRgn() == TRUE )
    {
     pBitmapBase->Fill(RGB(50,177,205));  // Fill the black region this color
     int error = pBitmapBase->Save((L_TCHAR*)(LPCTSTR)NewPageLocation.GetBuffer(1), FILE_TIFLZW, 8, PQ1, 0, NULL );
    }
    Region.Free();
    pBitmapBase->Free();
   }
  }

Thanks,

Rich

 

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 : Thursday, June 28, 2007 6:18:55 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

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

Can you resend the image that you wanted to send? Please put the Tiff image in a ZIP or RAR file so that our forum will allow posting it.

Also, if possible, can you send me your code in a small test project (not your full application) so I can check it for you?

 
#3 Posted : Thursday, June 28, 2007 6:28:02 AM(UTC)

RLenski  
RLenski

Groups: Registered
Posts: 12


Here is the image file as a zip file.  Once again thanks for looking into this.

Rich

 
#4 Posted : Thursday, June 28, 2007 6:42:03 AM(UTC)

RLenski  
RLenski

Groups: Registered
Posts: 12


Adnan,

Thanks for looking into this.  I have attached the zipped and attached the source code, and image file that is not working.  The code is c++.  For some reason when you load in the file at 1/2 the size painting the black pixels and saving the file works.  But when you load at the full size with the same function, the saved file is completely black.

Thanks,

Rich

File Attachment(s):
Problem.zip (32kb) downloaded 23 time(s).
 
#5 Posted : Sunday, July 1, 2007 4:18:50 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

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




Rich,


It seems the source code you sent uses MFC in a console
application. Please either send me the remaining files of this test project, or
at least tell me which version of Visual Studio you're using so that I can create my own project.

 
#6 Posted : Monday, July 2, 2007 8:25:58 AM(UTC)

RLenski  
RLenski

Groups: Registered
Posts: 12


Adnan,

 

Here is the full project, with files.  Please note the tif file goes into a c:\test directory.  Once again thanks for looking into this.  There seems to be something with how large of a file can be colored by region.

 

Thanks,

Rich

File Attachment(s):
ProjectAndFiles.zip (36kb) downloaded 22 time(s).
 
#7 Posted : Tuesday, July 3, 2007 6:11:39 AM(UTC)

Qasem Lubani  
Guest

Groups: Guests
Posts: 3,022

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

You will find attached
2 TIFF images generated using your code(one from each function call). I was able to successfully open them using our Main API demo. If you use our demo to view the files, do they work correctly?
File Attachment(s):
Test_NEWDoublSize.zip (561kb) downloaded 22 time(s).
 
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.162 seconds.