12

I converted a bunch of "normal" JPG photos via

convert infile -colorspace Gray outfile

to monochrome. However the result is for all images very dark. Here a sample conversion: original photo and converted monochrome image.

Is there a better way to convert a photo-realistic image with ImageMagick to gray-scale?

halloleo
  • 9,216
  • 13
  • 64
  • 122

1 Answers1

18

The documentation states that when changing the color space, the colors are converted from their original gamma to linear before the conversion. You need to convert them back to an appropriate gamma.

convert infile -colorspace Gray -gamma 2.2 outfile
Mark Ransom
  • 299,747
  • 42
  • 398
  • 622
  • Great idea. Is there an easy way to find out the gamma _a jpg was "recorded" with_? – halloleo Mar 14 '13 at 04:34
  • @halloleo, standard images are always 2.2 unless they were generated on an old Mac. – Mark Ransom Mar 14 '13 at 04:37
  • 1
    I just found [this answer](http://stackoverflow.com/questions/6082396/iphone-grayscaled-image-is-too-dark-can-i-change-the-opacity-of-gray-scale-im?rq=1) for a similar question. It says to convert the RGB values via the formula: Y = 0.30 x Red + 0.59 x Green + 0.11 x Blue This looks to me like a very different approach. Do I have to do both??? I'll try it out. – halloleo Mar 14 '13 at 04:38