ID:155598
 
I'm having trouble finding a way to save a plain image.

If I do this:
save_image()
var/image/I = foobar()
var/savefile/F = new("icon.png")
F << I
read_image()
var/savefile/F = new("icon.png")
usr << F


The file is written in DM's format, and I can't view the image at all. DM can't even read it back in.

I can get around this problem, sort-of, by specifying a path.
save_image()
var/image/I = foobar()
var/savefile/F = new("icon.png")
F["icon"] << I
read_image()
var/savefile/F = new("icon.png")
usr << F["icon"]


But I can't read it into a variable for some reason, I can only send it through output.

Does anyone know how to save images/icons in their native format?
You could try fcopy() or ftp(). However, I think you actually want an /icon, not an /image.
In response to DarkCampainger
Using fcopy to write the file works, but how do I read it back in to a variable?

Using 'usr << file("icon.png")' outputs to the user, but I can't figure out how to read it into a variable.
In response to Mardok
Nevermind, I figured it out:

var/icon/I = file("temp.png")
In response to Mardok
Reading from a savefile is done with
file >> object

not
object << file