Fix T52334: images with non-color data should not change color space on save.

This commit is contained in:
Brecht Van Lommel 2017-08-10 14:11:18 +02:00 committed by Sergey Sharybin
parent 0d86bc9f98
commit 35f5d80f3a
4 changed files with 11 additions and 3 deletions

View File

@ -2565,6 +2565,14 @@ const char *IMB_colormanagement_colorspace_get_indexed_name(int index)
void IMB_colormanagment_colorspace_from_ibuf_ftype(ColorManagedColorspaceSettings *colorspace_settings, ImBuf *ibuf)
{
/* Don't modify non-color data space, it does not change with file type. */
ColorSpace *colorspace = colormanage_colorspace_get_named(colorspace_settings->name);
if (colorspace && colorspace->is_data) {
return;
}
/* Get color space from file type. */
const ImFileType *type;
for (type = IMB_FILE_TYPES; type < IMB_FILE_TYPES_LAST; type++) {

View File

@ -588,7 +588,7 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters)
img_fol_t img_fol; /* only needed for cinema presets */
memset(&img_fol, 0, sizeof(img_fol_t));
if (ibuf->float_colorspace) {
if (ibuf->float_colorspace || (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA)) {
/* float buffer was managed already, no need in color space conversion */
chanel_colormanage_cb = channel_colormanage_noop;
}

View File

@ -152,7 +152,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
compression = (int)(((float)(ibuf->foptions.quality) / 11.1111f));
compression = compression < 0 ? 0 : (compression > 9 ? 9 : compression);
if (ibuf->float_colorspace) {
if (ibuf->float_colorspace || (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA)) {
/* float buffer was managed already, no need in color space conversion */
chanel_colormanage_cb = channel_colormanage_noop;
}

View File

@ -822,7 +822,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
/* convert from float source */
float rgb[4];
if (ibuf->float_colorspace) {
if (ibuf->float_colorspace || (ibuf->colormanage_flag & IMB_COLORMANAGE_IS_DATA)) {
/* float buffer was managed already, no need in color space conversion */
copy_v3_v3(rgb, &fromf[from_i]);
}