FFmpeg can be used to cahnge the resolution and aspect ratio of images and videos. Scaling filter provided by FFmpeg can be used for doing that.
$ ffmpeg -i <input-file> -vf scale=<width>:<height> <output-file>
For example.
# For video input
$ ffmpeg -i input.mp4 -vf scale=640:480 output.mp4
# For image
$ ffmpeg -i input.jpeg -vf scale=640:480 output.jpeg