I'm attempting to display a logo on the screen of my Pi. When I run the C++ code below I get the window with it's label to display, but not the JPEG image. The code compiled and linked, and the image resides in the same directory as the code. Any advice would be appreciated.
Try supplying the absolute path to the image, e.g.
Also, add some error checking to the jpg file loading
process; it might be saying the file
couldn't be opened for some reason.. see the error
checking example on this page.
--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/77c2fbe1-76da-27c7-58db-c3d419dc4c9e%40seriss.com.
Wouldn’t it be easier to use the getcwd() call to get the path to the folder in which the program was started?The program may not be installed in the same folder by another user.
Hmm, I'm not sure I know how getcwd() will help here.
getcwd() will just return the path to the current directory,
not necessarily where the .jpg is located.
On Thu, 29 Oct 2020 at 16:39, Greg Ercolano wrote:On 2020-10-29 08:57, Dave Branson wrote:
I'm attempting to display a logo on the screen of my Pi. When I run the C++ code below I get the window with it's label to display, but not the JPEG image. The code compiled and linked, and the image resides in the same directory as the code. Any advice would be appreciated.Try supplying the absolute path to the image, e.g.
// Load the imagelogo = new Fl_JPEG_Image("/some/absolute/path/logo.jpg");
Also, add some error checking to the jpg file loading process; it might be saying the file
couldn't be opened for some reason.. see the error checking example on this page.
Wouldn’t it be easier to use the getcwd() call to get the path to the folder in which the program was started?The program may not be installed in the same folder by another user.