Re: SaveBitmapMemory and BGR/RGB
Started by acook at 05-21-2007 16:45. Topic has 8 replies.
|
|
05-21-2007, 16:45
|
acook
Joined on 05-21-2007
Posts 9
|
|
|
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
Joined on 05-21-2007
Posts 9
|
Re: SaveBitmapMemory and BGR/RGB
Attachment: out.jpg
|
 
 
|
|
|
Here's a screenshot of the output
|
|
|
|
|
Report
|
|
|
|
05-22-2007, 10:15
|
acook
Joined on 05-21-2007
Posts 9
|
Re: SaveBitmapMemory and BGR/RGB
|
 
 
|
|
|
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

Joined on 05-31-2006
In House
Posts 1,621
|
Re: SaveBitmapMemory and BGR/RGB
|
 
 
|
|
|
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
Joined on 05-21-2007
Posts 9
|
Re: SaveBitmapMemory and BGR/RGB
|
 
 
|
|
|
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:24
|
acook
Joined on 05-21-2007
Posts 9
|
Re: SaveBitmapMemory and BGR/RGB
|
 
 
|
|
|
Will there be a v13 patch available or is that out of support?
|
|
|
|
|
Report
|
|
|
|
05-29-2007, 17:31
|
GregR

Joined on 05-31-2006
In House
Posts 1,621
|
Re: SaveBitmapMemory and BGR/RGB
|
 
 
|
|
|
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
Joined on 05-21-2007
Posts 9
|
Re: SaveBitmapMemory and BGR/RGB
|
 
 
|
|
|
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
|
|
|
|
|
LEAD Support Fo... » Developer » Color Conversio... » Re: SaveBitmapMemory and BGR/RGB
|
|
Copyright LEAD Technologies, Inc. 2008
