Page 1 of 1

Losslessly remove chrominance channels iff JPEG is grayscale

Posted: 2018-01-09T20:07:57-07:00
by hoanghuynh
Is there a way of losslessly reducing a JPEG image's bit-depth to 8 if it's already in grayscale?
CODE: SELECT ALL

magick convert image image
losslessly chooses the appropriate bit-depth for a grayscale PNG but results in recompression for JPEG. I'm currently using
CODE: SELECT ALL

jpegtran -grayscale -outfile tmpImage
and checking to see if
CODE: SELECT ALL

magick compare -metric rmse image tmpImage NUL