If you don't mind using SVG as an intermediary format, then inkscape
may be useful.
But you're probably looking for ImageMagick's convert
.
From the man page:
convert-im6.q16(1) General Commands Manual convert-im6.q16(1)
NAME
convert - convert between image formats as well as resize an image,
blur, crop, despeckle, dither, draw on, flip, join, re-sample, and
much more.
SYNOPSIS
convert-im6.q16 [input-option] input-file [output-option] output-file
OVERVIEW
The convert-im6.q16 program is a member of the ImageMagick-
ims6.q16(1) suite of tools. Use it to convert between image formats
as well as resize an image, blur, crop, despeckle, dither, draw on,
flip, join, re-sample, and much more.
For more information about the convert command, point your browser to
file:///usr/share/doc/imagemagick-6-common/html/www/convert.html (on
debian system you may install the imagemagick-6 package) or
https://www.imagemagick.org/script/convert.php.
It will use a compression which is relevant to the type of file you are using (jpegs are compressed differently than pngs). You may choose another type of compression using the -compress
flag and specify None, BZip, Fax, Group4, JPEG, JPEG2000, Lossless, LZW, RLE or Zip.
Use the -quality
option to set the compression level to be used by JPEG, PNG, MIFF, and MPEG encoders. Use the -sampling-factor
option to set the sampling factor to be used by JPEG, MPEG, and YUV encoders for down-sampling the chroma channels.