Displaying PNG and JPEG images

If you want to your game to display a picture, first you have to do a bit of preparation. The picture's filename needs to be listed in the Blorb resource file associated with your program (see Blorb) and be given a name to use when referring to it in your source. Glk supports two image formats: PNG and JPEG. JPEG is a lossy format, using a compression algorithm which cuts down considerably on file size at the cost of a small amount of unfaithfulness to the original picture. PNG is a non-lossy format with support for transparent pixels, much like GIF, only without the potential legal hassles that come with using GIF (which utilizes a patented compression algorithm.) JPEG is considered best for photos, PNG for things like hand-drawn art, images of text and the like. If your picture isn't in one of these two formats, you need to use a graphics program to convert it before you can use it in your Glulx Inform game.

Next, you need to decide where the picture is going to go. The chunk of screen space given to the Glulx interpreter will be split into a number of windows (see Glk windows), and you need to decide which one will be this particular image's destination. What you do from there depends on what kind of window the destination window is.


Next section: Graphics in a text buffer window
Or return to the table of contents