store "*.gif" file in Squeak

Ned Konz ned at squeakland.org
Thu Jan 8 04:32:32 UTC 2004


On Wednesday 07 January 2004 6:12 pm, ye juan wrote:

>   Who knows how to store a picture ("*.gif" file)into
> Squeak.
>   (1)  A "*.gif" file belongs to which class;

It doesn't.

A String naming a GIF file can be opened as a FileStream.

The GIF data can be *read from* a FileStream.

The GIF data from the FileStream can be *used to create* a Form.

The Form can be *written to* a FileStream.

>   (2) How to represent it and its other information,
> such as the date when it is produced, the author who
> creates it;


>   (3) how to read it in other applications in Squeak.
>   If you have similar demo, please send to me!
>    Regards, 

How to find out the answer to this and other questions in Squeak:

* use the browser, and search for classes with gif in their names:

we find AnimatedGIFReadWriter and GIFReadWriter

* use the Message Names tool, and search for methods with gif in their names:

we find

exportasGIF
fromGIFFileNamed:
httpGif:
httpShowGif:

Look at the class side methods in GIFReadWriter and ImageReadWriter, its 
parent class.

We see that we can say:

GIFReadWriter formFromFileNamed: 'myFile.gif'
which returns a Form (try it in a Workspace, and then inspect the result).

or

GIFReadWriter putForm: someForm onFileNamed: 'anotherFile.gif'.
which saves a Form to a file.

Now you can browse the Form class to see what you can do with them.

One thing that I do all the time to see if things are working is to say:

myForm openAsMorph

which will make an ImageMorph with the form.







More information about the Squeak-dev mailing list