Using ImageMagick (here we have a white bg, but you can specify any color):
convert input-image.png -transparent white transparent.pngOne can also use hex color codes for the same result:
convert input-image.png -transparent '#ffffff' transparent.pngImportant: This does not work on JPEG images since JPEG does not support transparent background.
Source: SO.
convert input.jpg -resize 800x output.jpg # Resize to a specific width while maintaining aspect ratio
convert input.jpg -resize 800x600 output.jpg # Resize to fit within a maximum width and height (e.g., within a 800x600 pixel box)
convert input.jpg -resize 50% output.jpg # Resize in a given proportion
mogrify -resize 50% image.jpg # Resize in placeidentify image.png
identify -verbose image.jpeg