09-19-2016 11:10 AM
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
Solved! Go to Solution.
09-22-2016 02:43 AM
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.
09-22-2016 04:22 AM
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
09-29-2016 02:04 AM - last edited on 11-18-2024 02:49 PM by Content Cleaner
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
.