You must have ImageMagick installed to run these commands. I honestly can’t remember if this is installed by default in Ubuntu or not. Running the following command will either install it, or let you know that it is already installed.
Resize an image.
Resize an image and save it with a new name, keeping the original image intact.
Resize all images of a certain type within a specified directory. This example will resize all images that have the .jpg extension, within the specified directory.
Resize an image to a maximum dimension. The image will resize until the width (first number) and height (second number) are no greater than the maximum limit set for that dimension.
Resize an image to a maximum dimension and save it with a new name, keeping the original image intact. The image will resize until the width (first number) and height (second number) are no greater than the maximum limit set for that dimension.
Resize all images of a certain type (within a specified directory) to a maximum dimension. This example will resize all images (within the specified directory) that have the .jpg extension until the width (first number) and height (second number) are no greater than the maximum limit set for that dimension.
Change the format of an image. This example will change image.jpg into image.png without altering the original image.
Change the format of all images of a certain type within a specified directory. This example will change all images (within the specified directory) that have the .jpg extension into images that have the .png extension, without altering the original images.
These are just some basics. Feel free to research some more about ImageMagick. You can do a lot more than just resize or change formats.