Contents

gif2spr Version 1.06a

A simple program to convert gif87a and gif89a graphic formats to Acorn Sprite format. Transparency masks for the GIF files are created to improve the appearance of the sprite. Version 1.06a will be the seventh release.

I cannot be held responsible for any damage or loss of data as a result of use or missuse of this program.

Installation and Usage

There are currently several other programs that require gif2spr to work correctly these normally include the latest version as of their release date. If you wish to update one of those version please check the documentation of those programs first but it should only require copying the new version of gif2spr to be copied into the appropriate place.

Command line installation

Please ensure that gif2spr is in a directory pointed to by Run$Path, my copy is saved in the library directory of my harddisc and my Run$Path looks like this.

Show Run$Path
Run$Path(Macro) : ,%.,Boot:Library.,ADFS::HardDisc4.$.Library.

Command line Usage

You can enter the pathname of a gif as the first file argument and the pathname of the sprite file as the second file argument.
gif2spr [-qvh?] RAM:$.in [-o] RAM:$.out
There are two options that can also be used.

Automated Conversion on the Desktop

The Following was suggested by Peter Burwood in demon.ip.support.archimedes. Create a directory called !gif2spr, in it place the following two obey files. This will create an application that when seen will allow you to double click on a gif89 file and have it converted and loaded into !Paint automatically without touching the command line.

Note you will have to use a filetype other than the registered gif type (695) if you want to be able to double click on gif87 format files and have them loaded into some other program. The file type used in this example is 089 and is named 'gif89'.

Also note that the sprite generated by gif2spr is left in the scrap directory, it can be deleted manually or automatically by uncommenting the last line of the !Run file.

-------- !Boot file ------------------------------
Set File$Type_089 GIF89
If "<gif2spr$Dir>" = "" Then Set gif2spr$Dir <Obey$Dir>
If "<gif2spr$Path>" = "" Then Set gif2spr$Path <Obey$Dir>.
If "<Alias$@RunType_089>" = "" Then Set Alias$@RunType_089 Run gif2spr:!Run %%*0
IconSprites <Obey$Dir>.!Sprites
--------------------------------------------------

-------- !Run file -------------------------------
IconSprites <Obey$Dir>.!Sprites
Set gif2spr$Dir <Obey$Dir>
Set gif2spr$Path <Obey$Dir>.
Set File$Type_089 GIF89
Set Alias$@RunType_089 Run gif2spr:!Run %%*0
|
IF "<Wimp$ScrapDir>" = "" Then ERROR 0 Scrap Application has not been seen
|
WimpSlot -min 128K -max 128K
Run <Obey$Dir>.gif2spr %0 <Wimp$ScrapDir>.gif2sprtmp
Filer_Run <Wimp$ScrapDir>.gif2sprtmp
|%delete <Wimp$ScrapDir>.gif2sprtmp
-------- !Run file -------------------------------

Notes

Only sprites with square pixel aspect ratios are generated.

This program appears to be at least twice as fast as ChangeFSI even though ChangeFSI has hand coded LZW decompression. This made me very happy when I tested it.

I've tested the program on 1,2,4,6,7,8 bits per pixel all the routines have been tested since 3bpp uses the 4bpp routines and 5,6,7bpp uses 8bpp I've only tested the transparency on 8bpp and 1bpp gifs, but the masking code is almost identical to the pixel code so should not cause any problems. I did check that part of the code for typos. The images I have were not suitable for creating transparency masks as they were scanned in and did not have large areas of single colour. This program has now been in use for many months with very few reported errors, if you find any please send me the report generated by gif2spr when run with the -v option on the offending GIF file. The GIF file would also be of use.

History

1.03 The code to deal with interlaced gif's has been re-coded since version 2 and is more likely to work correctly. Previously some images had a few lines in the wrong place making the image look quite odd.

1.04 has fixed a rare problem that occured when GIF's with multiple graphic extensions caused the error message 'liblug: Unkown input file type'

1.05 Another Rare error this was created by me several versions ago. It only happens when an empty transparent index graphic extension occurs in the data stream and generates the message 'liblug: Unkown input file type'

1.06 It appears that there is a program out there on the Mac that generates GIFs with an extra byte compressed on the end of the image data. The effect was to overwrite the beginning of another malloc'd block and caused an error when trying to free that memory. The extra byte only occures when a scan line is a multiple of 4 pixels. I have 6 examples of this problem.

Another problem generated by a Mac program (possibly the same) caused the same error message as above to occur but was because the gif had a strange definition for it's colour map and caused an unallocated pointer to be freed (This is partly bad programming but should not have occured if the gif had had it's flags set correctly). As a result of all this gif2spr is now more tolerant of strange GIF files.

1.06a The command line is now parsed by getopt allowing more flexibility and reliability.

My Thanks go to the following people (in no particular order) for suggestions and fault reports etc.

Contacting me

This is the Seventh distribution and was made on the 17th October 1995

Simon Truss
simon@bigblue.demon.co.uk

I can be contacted at the following address for a few years yet (It has to be forwarded on, but it will reach me)

23 Charlton Gardens
Coulsdon
Surrey
CR5 1AS


Simon Truss
Last Upated "Oct 17 1995"