UPDATE
Use following commands to install imaging package on Raspberry Pi
(1) For Raspberry Pi OS Bookworm and Bullseye :
sudo apt install python3-pil
(2) For Raspbian Buster :
sudo apt-get install python-pil
(3) For Raspbian Stretch and Jessie :
sudo apt-get install python-imaging