replace pil_to_array with plain array() call