With OS X , is there a way to create a 640 x 640 image out of a 500 x 640 image?
You can use the sips command to pad any JPEG or BMP image to a specified size, with a specified colour. In your case, the command would look something like:

sips photo-500x640.jpg --padToHeightWidth 640 640 --padColor 000000 --out photo-640x640.jpg


obviously with the input and output filenames of your choice. For white instead of black borders, change 000000 to FFFFFF.