Opening a .PICT file in Squeak 3.5

Richard A. O'Keefe ok at cs.otago.ac.nz
Mon Jun 16 01:02:04 UTC 2003


On the weekend I did some statistical calculations on a Mac, saved the
window with the graph I wanted as a PICT file using 
Command+shift+4+capslock as described in Mac OS help,
and saved the resulting "Picture 1" file on a ZIP disc.
Today I put that ZIP disc in my office Mac, clicked on "Picture 1",
and Simpletext showed me exactly what I had seen at home.

Unfortunately, "Save Window as PICT file" saves the frame of the window
as well as the content, and I don't actually want that frame.  So I thought
I might have a go at editing it in Squeak.

Fire up unmodified Squeak 3.5 #5180 on my MacOs 8.6 Power Macintosh G3.
Open|File List.
Select ZIP disc in top left pane.
Select Picture 1 in top right pane.
Bottom pane now says "For some reason, this file cannot be read."

But it _can_ be read; Simpletext just read it!

Well, it's not text.  Maybe that's what it means.  I don't want to
read it, I want to display it as an image.

With "Picture 1" still selected, bring up the menu
(Option|mouse) and ask for more... and then
choose "Open graphic in a window".
A box pops up telling me "Picture 1 does not exist".

But it _does_ exist; the top right pane has the modification date
and the file size in bytes exactly right.

The alternatives are "choose another name" and "cancel".
"Cancel" results in a "MessageNotUnderstood: binary"

UndefinedObject(Object)>>doesNotUnderstand:      #binary
Form class>>openImageInWindow:
    fullName is 'ZIP-100:Picture 1'		-- right name
    FileStream readOnlyFileNamed: 'ZIP-100:Picture 1'
    was responsible for popping up the box saying "Picture 1 does not
    exist" (although it does).  It returned nil.

Suggestion:
change
    myStream := (FileStream readOnlyFileNamed: fullName) binary.
to
    myStream := FileStream readOnlyFileNamed: fullName.
    myStream ifNil: [^nil].
    myStream := myStream binary.

I see from the comment in that method that only GIF, JPG, PNG, BMP,
and the result of "Form storeOn: ..." are supported.  It's a pity that
a Macintosh program cannot read a Macintosh PICT file.

If I can't do it with Squeak, has anyone else any suggestions for how I
can crop a PICT file and turn the result into a GIF?



More information about the Squeak-dev mailing list