tjLoadImage(): return TJPF_GRAY for grayscale BMPs

... if *pixelFormat=TJPF_UNKNOWN is passed to the function.
This commit is contained in:
DRC
2017-11-19 08:43:07 -06:00
parent 479fa1d870
commit e817c07779
2 changed files with 20 additions and 1 deletions

View File

@@ -133,6 +133,9 @@ read_colormap (bmp_source_ptr sinfo, int cmaplen, int mapentrysize)
break;
}
if (sinfo->cinfo->in_color_space == JCS_UNKNOWN && gray)
sinfo->cinfo->in_color_space = JCS_GRAYSCALE;
if (sinfo->cinfo->in_color_space == JCS_GRAYSCALE && !gray)
ERREXIT(sinfo->cinfo, JERR_BAD_IN_COLORSPACE);
}