fix error:Failed to allocate memory for image.