Spritefile contains Python classes for reading and writing Spritefiles with tools for conversion and interoperability with other image formats.
The Spritefile format is the standard file format for storing bitmap images on the RISC OS platform. This popularity is mainly due to their use by the operating system facilities for rendering images in the desktop environment and the closeness of the stored data to the framebuffer structure on early RISC OS machines, such as the Archimedes, A3000, A540 and so on. Despite the popularity of so-called "Internet image formats", support for non-native image files within RISC OS has lagged behind the support available for toolkits such as Qt and GTK. A consequence of this is that a substantial amount of images found on a RISC OS workstation will be stored in Spritefiles. Another reason for the continued use of Spritefiles for storing images is their support for multiple images within a single file; a feature which is often neglected by some types of applications which only require a single image per file.
Available libraries and tools
The spritefile module
When writing a library of classes to interpret the contents of Drawfiles it became apparent that a substantial amount of work was required to provide support for objects containing sprites. Therefore, a separate module was created for this purpose, its interface similar to the one implemented for the Python GUI library I had been working on.
The module was initially written purely in Python but, to speed up the processing of large images, some of the methods which manipulate the image data were moved to a separate library written in Pyrex, which makes writing C extensions to Python fairly simple. However, if the compiled extension module cannot be found at runtime then the module falls back on original methods to process image data.
The Spritefile format has been modified and extended many times by many parties. It is likely that there are numerous Spritefiles inexistence which will not be interpreted correctly by this module. However, the following features at least are supported:
· New style sprites with 1, 2, 4, 8, 16 and 32 bits per pixel.
· Old style sprites with mode numbers, as long as the number is in a list of "known" values. Masks in all of the colour depths listed.
· Palettes with 2, 4, 16, 64 and 256 entries, including the standard RISC OS 16 colour palette and the default 64 entry VIDC palette.
· CMYK sprites, to a limited extent.
spr2img and spr2other
These Python tools put a simple command line interface on top of the spritefile module, allowing the user to extract images in formats supported by the Python Imaging Library. The spr2img tool will extract all the images within the Spritefile in the desired format whereas the spr2other tools allows the user to extract named images to specific files of the desired format.
What's New in This Release:
· Changed the license to the GNU General Public License.