Im trying to figure out how to code a program, that shows a picture. The only problem I have at the moment, is that the picture will only show on my computer, but not on others. Do you guys have any idea on how to fix that?
A program that opens a picture. But the only problem is that the program can only open the picture on my computer, because I already have the picture in some folder. I want it to open the picture on all computers even the ones that dont have the picture in a folder.
So I somehow want to know how to code the .jpeg inside the .exe, so when you open the .exe file it opens the same picture on all computers.
the dumb way to do it (its horrible, but it will work without an image file of any sort anywhere) is to write a program that dumps the raw bytes of the image file into a legal constant vector of bytes that you can then display (or if jpeg, decode and then display). The image just becomes a very large constant data item in your program. Some types of images can be generated via an algorithm, like a background.
there are many other ways... you can store them in resources or dlls in windows, for example, or on a server, or you can install the image with the program in a folder in a relative path that the executable can find, for a few quick examples. Most games use a relative path to a known folder full of images or a 'wadfile' that has a bunch of images in one big file. Ever installed a game for 30 min?? Its copying video/images/sounds mostly. THe actual code part is usually relatively small.
In order to render an image to display, its data must be accessible. You must transfer the image data to the computer somehow.
* Copy both image file and executable to destination
* Embed image data into the executable and copy executable to destination
* Copy executable to destination and let it copy image data during runtime from network accessible source