Allow passing a file object to _pack_image and related endpoints