Q:

Finding min and max symbology for each band at command line using GDAL?

I would like to automate the process of getting the correct symbology min/max scale for each of the RGB bands via command line. 
My use case is I am converting multi-band GEOTIFFs to JPG using the following command
 gdal_translate -ot Byte -of JPG -b 1 -b 2 -b 3 -scale_1 0 439 -scale_2 0 460 -scale_3 0 454 -a_nodata none test.tiff output2.png -co PHOTOMETRIC=RGB

The scales change frequently, and without the correct min and max, the images appear black.
My solution (which does not scale) is I have been getting the scales by loading my GEOTIFFs into the QGIS3 UI software and then looking at what QGIS3 sets for the symbology mins and maxs for each color band. I would like to automate the process of figuring out the color band min/max scales via command line.

A:

gdalinfo -mm -stats test.tiff 

The -stats option read and display the image statistics.
If no statistics are stored in the image file, the -mm option forces the computation for each band.  

