Changed to using IO stream to PIL