I’ve been unable to load a bitmap image with the PxLoadImage function. I’ve tried all kinds of paths, file names and color depths. Attached is the code snipet.
Can I get more information about the source of the error? Does anybody have an idea?
PhImage_t *pclImage = PxLoadImage(“slideryellow.bmp”,NULL);
if (pclImage == NULL)
{
slogf(_SLOG_SETCODE(_SLOG_SYSLOG,0),_SLOG_ERROR,
“Unable to load image.”);
}
You can get more info about the source of the error by supply methods rather than NULL to the PxLoadImage functions, I think there is an example of this on qnx.com. Does the problem occur on JPG, PNG or GIF files? Are you sure your user has read permission to the file? I think for safety, you maybe want to give a full filepath too.
Thanks, I will try the handlers. The file is bitmap … I’ve tried 24bit, 8 bit and 4bit versions. I have also tried full path names and have set the read protections all with no luck.
I’ll try playing with the input structure tomorrow.
I tried the error catcher(s) with no luck. The error message is “Could not load image”. The memory allocation functions don’t even get called. No help here.
I found on-line a snippet that looks like it defines the images types.
#define PX_IMAGE_MODULES // define the modules we want #define PX_GIF_SUPPORT #define PX_JPG_SUPPORT #define PX_PCX_SUPPORT #define PX_BMP_SUPPORT
#include <photon/PxImage.h>
This was for ver 6.1.0, I’m running Ver 6.2.0 NC. I tried this, still no luck.
How does the function know what type of image it’s trying to read?
I don’t know how it knows the type of image, I suppose it just has a sniff of it and can tell from the first few bytes. If you want, post the source, and I’ll try it on 6.3.
I tried the error catcher(s) with no luck. The error message is “Could not load image”. The memory allocation functions don’t even get called. No help here.
I found on-line a snippet that looks like it defines the images types.
#define PX_IMAGE_MODULES // define the modules we want #define PX_GIF_SUPPORT #define PX_JPG_SUPPORT #define PX_PCX_SUPPORT #define PX_BMP_SUPPORT
#include <photon/PxImage.h>
This was for ver 6.1.0, I’m running Ver 6.2.0 NC. I tried this, still no luck.
How does the function know what type of image it’s trying to read?
I compiled the program using static linking and it gave me a different load error “unable to load Image library”. This is a little more disciptive and pointed me in the right direction.
The loader uses the LD_LIBRARY_PATH to look for dynamic libraries. Appearently, these are loaded manually in the code regardless of the linker switch. Anyway, I pointed LD_LIBRARY_PATH to /usr/photon/dll directory where the image loader DLLs are (pi_io_bmp.so) and it works fine.
I’m trying to use a function that uses the same library. On a full qnx target, the function works fine. On a target with a flash disk, it doesn’t work because the “pi_io_bmp.so” library is not loaded.My problem is : I can’t load it even with the soft compiled with a static link to the library and LD_LIBRARY path pointing to the directory where the library is. I tried to load it with the ld command but nothing works. Do I have to load it at the same time than a driver or something like that ?
Something that might be important, we don’t use photon completely, just some functionalities, we got our user interface.
DL_DEBUG helps a lot.
I figured that one library was missing on my target :
libphimg.so
and also that pi_io_bmp.so has to be in /usr/photon/dll because I think liphimg.so opens it with this path.