convert object to imgdata