Mercurial > octave-nkf
changeset 19728:c334e4af3a1b
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.
author | Ilya Kurdyukov <olme8@mail.ru> |
---|---|
date | Wed, 11 Feb 2015 17:40:04 +0000 |
parents | 05b40890bbb2 |
children | a4f6fbd1af77 |
files | libinterp/dldfcn/__magick_read__.cc |
diffstat | 1 files changed, 3 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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;