ImageMagick is an extremely useful piece of software. There are several interfaces (graphical, commandline and library), but I prefer the commandline.
= Correcting rotation =
Yes, there's plenty of websites who will strip off the EXIF flags after uploading your JPEG and thus show your pictures in the wrong orientation. ImageMagick has a nice option for this. It'll read out the EXIF orientation flag, then rotate the image in the old-fashioned way:
$ convert candelabra.jpg -auto-orient candelabra_rotated.jpg
= Tiling =
I often have a need to concatenate a number of images and create them as one image. Montage is wonderful for this:
$ magick montage -geometry +0+0 -tile 1x2 image1.png image2.png montage.png
This will place the image1 above image2 (i.e. in a column). Thus 1x2 means, create a montage of 1 pictures wide and 2 pictures in height.
Note that if you want to repeat a single image, the above command isn't great. You then actually want to ''tile'' an image. For example, suppose you have a portrait photo of width 500 and height 1000 to create passport photos, you'd do something like below. You'll then get two rows, with 6 images on each row.
$ magick convert -size 3000x2000 tile:portrait.jpg passport_photos.jpg
= Padding while resizing =
If you need to resize images to a certain size, you'll probably need to retain the width/height ratio. This is where the extent parameter comes in:
$ magick convert -resize 250x50 -gravity center -extent 250x50 -background none \ logo-home.png logo-home_small.png
In the above case, the background is set to ''none'' (i.e. transparent), but defaults to white.
= Padding =
To keep an image at the same size, but just pad it in a border of transparent pixels to get a touchable area of 50x50 pixels:
$ magick convert small_button.png -gravity center -background none -extent 50x50 small_button_padded.png
= Grayscale =
The correct parameters to convert a color scan of some handwritten notes to black & white:
$ magick convert notes.jpg -monochrome -colors 2 notes_bw.jpg
For background information: https://poizan.dk/blog/2014/02/28/monochrome-images-in-imagemagick/
= EXIF =
To strip EXIF data from an image:
$ magick mogrify -strip image.jpg