Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
-
cow10
- Posts: 1
- Joined: 2017-12-29T01:04:36-07:00
- Authentication code: 1152
Post
by cow10 » 2017-12-29T01:15:51-07:00
Is there a way of losslessly reducing a JPEG image's bit-depth to 8 if it's already in grayscale?
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
is "
0 (0)" before replacing the image, though I'd prefer an IM-only solution if possible.
-
snibgo
- Posts: 10030
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Post
by snibgo » 2017-12-29T03:45:17-07:00
IM is a general-purpose raster image processor. So it reads a file and decompresses it, processes the image, then compresses and writes a file. If the output format is JPEG, this will almost certainly be lossy.
Some operations on JPEG can be lossless, but only by doing those operations with intimate knowledge of how JPEG works. IM doesn't do that. Specialist programs such as jpegtran do.