Converts ImageRef to serialized string representation with acquiring serialized reference to the native resource. You must eventually call deserialize, otherwise the reference will leak