From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Open image ".bmp" error -12 out memory

Solved!
Go to solution

Hi, All

 

I have a image ".bmp" (the camera sick send me photo by ftp, attached example), but i cannot open the file with Labwindows for see.

For example the function  DisplayImage 

  DisplayImageFile (panel, PRODUCTION_PICTURE, "sick0.bmp"); 

 

This fuction return me error -12. 

 

I can open the image with windows, paint and others software, but i cannot see the image in my software.

 

how can I solve that?  Any suggestions?

 

Thanks

 

 

Best regards

0 Kudos
Message 1 of 4
(3,383 Views)
Solution
Accepted by topic author JoseTorre

I do not understand how it could happen, but the files you have attached do not follow .bmp format and apparently CVI functions cannot correct the error as normal image viewers are able to do.

Going specifically, the BITMAPINFOHEADER section oh the file header appears corrupted, holding -480 in its biHeight field instead of 480. You can see the value by examining the file with a hex editor: at offset 22 you read 20 FE FF FF. Modifying these values to E0 01 00 00, corresponding to 480, the image can be loaded in CVI controls without problems. I am attaching the updated image for your reference.

This situation affects both DisplayImageFile, GetBitmapFromFile and GetBitmapFromFileEx commands.

You should try understanding where this anomaly comes from: whether directly from the camera or in ftp transfer or I don't know where.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 4
(3,333 Views)
Solution
Accepted by topic author JoseTorre

Thanks Roberto.

 

The Camera (Sick PIM60) send me the photo across ftp.

I have actived the server ftp of "Windows 7" for this task.

 

My temporal solution is open the image with the controller ".net" and save with the same controller, then I can open the file with the "DisplayImageFile, GetBitmapFromFile and GetBitmapFromFileEx commands".

 

Example:

 System_Drawing_Bitmap  imageHandle;  

...

 System_Drawing_Bitmap__Create (&imageHandle, file_source, 0);      
 System_Drawing_Bitmap_Save (imageHandle, file_target, 0);

 System_Drawing_Bitmap_Dispose (imageHandle, 0);

...
 status = DisplayImageFile (PANEL, PANEL_PICTURE, file_target);     
     
   

Best Regards.   Jose Angel  

 

 

 

0 Kudos
Message 3 of 4
(3,330 Views)

It seems there is a known issue about this

Passing a bitmap file containing negative heights to PlotBitmap or GetBitmapFromFile causes a non-fatal run-time error: Library function error (return value == -12 [0xfffffff4]). Out of memory.

0 Kudos
Message 4 of 4
(3,228 Views)