python script to converting .jpg to .pgm