I think PythonMagick will let you do this. It's the Python version of ImageMagick
If you're going to insist on a particular aspect ratio, it'll probably make sense to let the user select a region of the right aspect ratio from their profile photo. For instance, Twitter profile photos are square, 48px by 48px. If you don't let the user choose a region of the right aspect ratio, then the image will be squished when you scale it down.
Security note: It's worth mentioning that always running user-uploaded images through a thumbnailing program is a good idea, as it's possible for malicious users to embed information in various image file types that can lead to security holes. There have been a series of these discovered over the last several years, and it's reasonable to expect that there are more. Another good practice is to serve user-supplied content from a non-trusted domain, so malicious code uploaded by users can't steal your application's cookies.