diff options
author | Brecht Van Lommel <brecht> | 2022-05-13 17:03:26 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-05-13 18:55:54 +0300 |
commit | 5baa3ecda66337c0584f0bc6c6e7af0a6c0f6320 (patch) | |
tree | b751cbb3fbbe257bff0a85ad5c39d2643e172323 /source/blender/editors | |
parent | 1e4cd98f0a948fbd947f79c220e7834c99a44f65 (diff) |
Color Management: various improvements and fixes for image saving
* Respect the image file color space setitng for saving in various cases where
it was previously ignored. Previously it would often use the sRGB or Linear
color space even when not selected.
* For the Save As operator, add a Color Space option in the file browser to
choose the color space of the file. Previously this was chosen automatically,
now it's possible to e.g. resave a Linear image as Linear ACES.
* When changing the file format, the colorspace is automatically changed to an
appropriate color space for the file format. This already happened before, but
there was no visibility or control in the operator settings for this.
* Don't change color space when using the Save operator to save over the same
file.
* Fix missing color space conversion for 16 bit PNGs, where it assumed wrongly
assumed ibuf->rect would be used for saving. Add BKE_image_format_is_byte to
more accurately test this.
Fixes T74610
Ref T68926
Differential Revision: https://developer.blender.org/D14899
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 12ff821f7aa..20f6bae3e52 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1775,6 +1775,7 @@ static int image_save_as_exec(bContext *C, wmOperator *op) if (op->customdata) { isd = op->customdata; image_save_options_from_op(bmain, &isd->opts, op); + BKE_image_save_options_update(&isd->opts, isd->image); } else { isd = image_save_as_init(C, op); @@ -1794,9 +1795,14 @@ static int image_save_as_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -static bool image_save_as_check(bContext *UNUSED(C), wmOperator *op) +static bool image_save_as_check(bContext *C, wmOperator *op) { + Main *bmain = CTX_data_main(C); ImageSaveData *isd = op->customdata; + + image_save_options_from_op(bmain, &isd->opts, op); + BKE_image_save_options_update(&isd->opts, isd->image); + return WM_operator_filesel_ensure_ext_imtype(op, &isd->opts.im_format); } @@ -1839,7 +1845,7 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) ImageSaveData *isd = op->customdata; PointerRNA imf_ptr; const bool is_multiview = RNA_boolean_get(op->ptr, "show_multiview"); - const bool use_color_management = RNA_boolean_get(op->ptr, "save_as_render"); + const bool save_as_render = RNA_boolean_get(op->ptr, "save_as_render"); uiLayoutSetPropSep(layout, true); uiLayoutSetPropDecorate(layout, false); @@ -1852,7 +1858,14 @@ static void image_save_as_draw(bContext *UNUSED(C), wmOperator *op) /* image template */ RNA_pointer_create(NULL, &RNA_ImageFormatSettings, &isd->opts.im_format, &imf_ptr); - uiTemplateImageSettings(layout, &imf_ptr, use_color_management); + uiTemplateImageSettings(layout, &imf_ptr, save_as_render); + + if (!save_as_render) { + PointerRNA linear_settings_ptr = RNA_pointer_get(&imf_ptr, "linear_colorspace_settings"); + uiLayout *col = uiLayoutColumn(layout, true); + uiItemS(col); + uiItemR(col, &linear_settings_ptr, "name", 0, IFACE_("Color Space"), ICON_NONE); + } /* multiview template */ if (is_multiview) { |