You might want to use ImageMagick. It isn't included in the default installations of Ubuntu and many other Linux distributions, so you will have to install it first. Use the following command:
sudo apt-get install imagemagick
You can specify a width (or height) and ImageMagick will resize the image for you while preserving the aspect ratio.
The following command will resize an image to a width of 2000:
convert example.png -resize 2000 example.png
There is also an option so that it will only shrink images to fit into the given size. It won't enlarge images that are smaller. This is the '>' resize option. Think of it only applying the resize to images 'greater than' the given size, the syntax might be a little counter-intuitive.
convert example.png -resize 2000\> example.png
You can use bash
to apply the command to all of your images,
for file in *.png; do convert $file -resize 2000\> $file; done