Convert RGB to Grayscale in ImageMagick command-line

前端 未结 7 1052
孤街浪徒
孤街浪徒 2020-12-23 16:16

How do I convert a RGB image (3 channels) to a grayscale one, using the (r+g+b)/3 method? I look through an examples page: http://www.imagemagick.org/Usage/color_mods/#grays

7条回答
  •  情歌与酒
    2020-12-23 16:33

    I use convert mostly to convert colour pictures of documents into grey-scale pdf documents in order to perform OCR. My best results are using Rec709Luminance. So I recommend

    convert colourpicture.png -grayscale Rec709Luminance greyscalepicture.png
    

    Short command, nice outputs.

提交回复
热议问题