Converting image into a b-array/JSON