converts images to byte data