JPEG Decode  -  Converts JPEG files to 256-colour sprites

by J.B. Pickard

The JPEG file format is widely used across all computer platforms for storing photographic images. It is a lossy compression format - i.e. some of the information in the original picture is lost during compression. However, the compression technique used is sufficiently sophisticated that the lost detail is not noticeable to the viewer, and with careful setting of the quality option when creating a JPEG, compression ratios of 10:1 and greater are possible with no visible loss of image detail.

The standard method of displaying images on Acorn computers is the sprite format, which is uncompressed. JPEGs are supported as standard on the latest models fitted with RISC OS 3.6, but on earlier machines a converter program is required. For pre-Risc PC machines, which are restricted to 256 colours, the JPEG decoder provided here is idealfor converting JPEG images to 256-colour sprites. It can also, of course, be used on later models if you don't need greater colour depth, or if the JPEG was created from a 256-colour image in the first place.

Using JPEG Decode
Running the program from the RISC User menu system, or from a Filer window, installs an icon on the icon bar. Dragging any JPEG file (filetype &C85) to the icon bar icon, or double-clicking on the file while JPEG Decode is running, will initiate the conversion process. A small Save box will appear, and you may drag the sprite icon to the required destination. Note that the filename is not changed unless you alter it yourself, so don't drag the icon back over the original file if you don't want to lose the original. The JPEG will now be converted to a sprite and saved in the specified location. Depending on the size and complexity of the image, this part of the process may take a few seconds to complete.

Clicking Menu over the icon bar icon opens a menu with four options. Info and Quit perform their usual functions. Brightness leads to a dialogue box containing a number of brightness settings from Very dull to Very bright. Choosing one of these options allows you to alter the brightness of the resulting image. The default setting is Average and this should be suitable for most purposes.

The remaining menu option is Fast. Choosing this option toggles the fast screen blanking routine on or off. When this is on, the conversion process on older machines is speeded up by avoiding the need to refresh the screen while the process takes place. On newer models (i.e. with ARM3 or later processors), this option is unlikely to be of any benefit.

On machines with 4Mb or more of RAM, most conversions will be done within the machine's memory. On machines with less memory, or if many applications are loaded, the conversion might need disc space. The application uses the Wimp$Scrap system variable to save a temporary sprite file to a disc (preferably a hard disc). If this variable has not been set (i.e. !Scrap has not been seen), an error occurs on startup.

If there is not enough disc space to store the temporary file during image processing, an error occurs and the conversion is stopped.

Copyright  RISC User 1996
