# HG changeset patch # User Ilya Kurdyukov # Date 1423676404 0 # Node ID c334e4af3a1b194ec462342987673279882836ee # Parent 05b40890bbb28caaebdcc58792a1d338e45e1db1 Fix incorrect writing of grayscale JPEG images (bugs #41673, #44118, #42474) * __magick_read__.cc: when writing grayscale images, we should create a Magick::Image object of Magick::GrayscaleType type, then use Magick::Color with only the red channel set (the other channels would be ignored). However, this seems to not work for JPEG images which would then generate grayscale images with one third of the intensity. This fixes it. diff -r 05b40890bbb2 -r c334e4af3a1b libinterp/dldfcn/__magick_read__.cc --- a/libinterp/dldfcn/__magick_read__.cc Tue Feb 10 23:19:44 2015 +0100 +++ b/libinterp/dldfcn/__magick_read__.cc Wed Feb 11 17:40:04 2015 +0000 @@ -1108,8 +1108,9 @@ { for (octave_idx_type row = 0; row < nRows; row++) { - Magick::Color c; - c.redQuantum (double (*img_fvec) / divisor); + const double grey = double (*img_fvec) / divisor; + Magick::Color c (grey, grey, grey); + pix[GM_idx] = c; pix[GM_idx] = c; img_fvec++; GM_idx += nCols;