Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Re: SaveBitmapMemory and BGR/RGB
Started by acook at 05-21-2007 16:45. Topic has 8 replies.

Print Search « Previous Thread Next Thread »
  05-21-2007, 16:45
acook is not online. Last active: 10/25/2007 10:25:32 PM acook

Top 500 Posts
Joined on 05-21-2007
Posts 9
SaveBitmapMemory and BGR/RGB

Attachment: energie_groß01_2.jpg
Reply Quote
I have a JPEG image that I'm loading with the following API calls

HGLOBAL hFileInMemory;
unsigned long ulImgSize;
BITMAPHANDLE bmhLEAD;
char * pImgData;

L_LoadBitmap((LPSTR)filename, &bmhLEAD, 0, ORDER_BGR, NULL, NULL);
L_FlipBitmap(&bmhLEAD);
L_SaveBitmapMemory(&hFileInMemory, &bmhLEAD, FILE_PPM_BINARY, 24, 0, &ulImgSize, NULL);
pImgData = (char*)::GlobalLock(hFileInMemory);

However, the bitmap I get back is bit shifted from what the original file looks like.  (i.e. BGR actually comes back as RBG)

Does anyone know what's causing this?  Virtually identical JPGs will come through this process correctly (bmp ends up BGR) so I'm not sure why this one JPG comes through wrong.  I'll attach the jpg here and try to attach the output jpg to a reply.





   Report 
  05-21-2007, 16:49
acook is not online. Last active: 10/25/2007 10:25:32 PM acook

Top 500 Posts
Joined on 05-21-2007
Posts 9
Re: SaveBitmapMemory and BGR/RGB

Attachment: out.jpg
Reply Quote
Here's a screenshot of the output


   Report 
  05-22-2007, 10:15
acook is not online. Last active: 10/25/2007 10:25:32 PM acook

Top 500 Posts
Joined on 05-21-2007
Posts 9
Re: SaveBitmapMemory and BGR/RGB
Reply Quote
Also I forgot to mention, I can see this with Leadtools v13 and v14.5.  I haven't tried v15

   Report 
  05-22-2007, 16:07
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,705
Re: SaveBitmapMemory and BGR/RGB
Reply Quote
I tried loading and saving your JPG file but it still looks the same when I open it back up in LEADTOOLS.  Are you using something other than LEADTOOLS to open the image?  Does the same thing happen if you save the file to disk?

What is the full version # of LEADTOOLS 13 and 14.5 that you are using?

Greg Ross
LEADTOOLS Technical Support
   Report 
  05-29-2007, 11:50
acook is not online. Last active: 10/25/2007 10:25:32 PM acook

Top 500 Posts
Joined on 05-21-2007
Posts 9
Re: SaveBitmapMemory and BGR/RGB
Reply Quote
The full version of 14.5 we're using is 14.5.0.43.

The full version of 13 is 13.0.0.79.

Yes, we are taking the bitmap in memory (pImgData) and writing it to disk and that is the result I'm talking about.  However my example output is just a screenshot.


   Report 
  05-29-2007, 17:21
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,705
Re: SaveBitmapMemory and BGR/RGB
Reply Quote
I'd lke to get you up to date on the files.  Since the forums are publically viewable, this cannot be done here so please send an email to support@leadtools.com in order to get the download instructions for the latest v14.5 patch.  For verification purposes, be sure to include the following information:
 
1. The company you work for
2. The LEADTOOLS serial number you own (if you are evaluating, just say so and we'll send you the eval patch)
3. The name(s) of the developer(s) using the serial number
4. A link to this forum post

Greg Ross
LEADTOOLS Technical Support
   Report 
  05-29-2007, 17:24
acook is not online. Last active: 10/25/2007 10:25:32 PM acook

Top 500 Posts
Joined on 05-21-2007
Posts 9
Re: SaveBitmapMemory and BGR/RGB
Reply Quote
Will there be a v13 patch available or is that out of support?

   Report 
  05-29-2007, 17:31
GregR is not online. Last active: 11/17/2008 11:10:19 AM GregR



Top 10 Posts
Joined on 05-31-2006
In House
Posts 1,705
Re: SaveBitmapMemory and BGR/RGB
Reply Quote
Yes, sorry for not being more clear.  Version 13 is no longer being updated, but I will still send you the instructions for the last build (13.0.0.130) once you send an email to support@leadtools.com and verify the needed information.

Greg Ross
LEADTOOLS Technical Support
   Report 
  05-31-2007, 16:38
acook is not online. Last active: 10/25/2007 10:25:32 PM acook

Top 500 Posts
Joined on 05-21-2007
Posts 9
Re: SaveBitmapMemory and BGR/RGB
Reply Quote
I have figured out the problem, it turns out it's with our code after leadtools is called.  We're dumping the output from SaveBitmapMemory to disk, however we're stripping the file headers first, and we were stripping the PPM file headers incorrectly in some cases, which caused the image to no longer be aligned properly.

   Report 
Post
LEAD Support Fo... » Developer » Color Conversio... » Re: SaveBitmapMemory and BGR/RGB

Powered by Community Server, by Telligent Systems