I ran into this problem after creating a cropping proc for user-uploaded icons, and after a bit of experimenting it finally dawned on me that the "raw" file data differs from the content of an /icon object:
#define INPUT "default.input1"
#define OUTPUT "default.output1"
icon/display_icon = null
set_icon_raw(i as icon)
usr.display_icon = i
set_icon_object(i as icon)
usr.display_icon = icon(i)
speak(t as text)
world << output("<img src=\"\ref[usr.display_icon]\">[usr.name]: [t]",OUTPUT)
Obviously I'd assume this distinction is intentional, but the kind of situation as above creates problems because I can't find any way to turn the /icon object back into file data. I know it's automagically converted back to the necessary file data when assigned to atom.icon and other vars, but how can I accomplish the same when these vars aren't involved?
This is the cropping proc I was referring to:
icon/i = icon(a)
icon_x = i.Width()
icon_y = i.Height()
if(icon_x > m_x || icon_y > m_y) i.Crop(1,1,min(icon_x,m_x),min(icon_y,m_y))
This function can't be accomplished without turning it into an /icon object, so I run into the problem described above.