Blender  V3.3
Functions
image_save.cc File Reference
#include <cerrno>
#include <cstring>
#include "BLI_listbase.h"
#include "BLI_path_util.h"
#include "BLI_string.h"
#include "BLI_vector.hh"
#include "DNA_image_types.h"
#include "MEM_guardedalloc.h"
#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include "IMB_openexr.h"
#include "BKE_colortools.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_image_format.h"
#include "BKE_image_save.h"
#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_scene.h"
#include "RE_pipeline.h"

Go to the source code of this file.

Functions

static char imtype_best_depth (ImBuf *ibuf, const char imtype)
 
bool BKE_image_save_options_init (ImageSaveOptions *opts, Main *bmain, Scene *scene, Image *ima, ImageUser *iuser, const bool guess_path, const bool save_as_render)
 
void BKE_image_save_options_update (ImageSaveOptions *opts, const Image *image)
 
void BKE_image_save_options_free (ImageSaveOptions *opts)
 
static void image_save_update_filepath (Image *ima, const char *filepath, const ImageSaveOptions *opts)
 
static void image_save_post (ReportList *reports, Image *ima, ImBuf *ibuf, int ok, const ImageSaveOptions *opts, int save_copy, const char *filepath, bool *r_colorspace_changed)
 
static void imbuf_save_post (ImBuf *ibuf, ImBuf *colormanaged_ibuf)
 
static bool image_save_single (ReportList *reports, Image *ima, ImageUser *iuser, const ImageSaveOptions *opts, bool *r_colorspace_changed)
 
bool BKE_image_save (ReportList *reports, Main *bmain, Image *ima, ImageUser *iuser, const ImageSaveOptions *opts)
 
static floatimage_exr_from_scene_linear_to_output (float *rect, const int width, const int height, const int channels, const ImageFormatData *imf, Vector< float * > &tmp_output_rects)
 
bool BKE_image_render_write_exr (ReportList *reports, const RenderResult *rr, const char *filepath, const ImageFormatData *imf, const bool save_as_render, const char *view, int layer)
 
static void image_render_print_save_message (ReportList *reports, const char *name, int ok, int err)
 
static int image_render_write_stamp_test (ReportList *reports, const Scene *scene, const RenderResult *rr, ImBuf *ibuf, const char *name, const ImageFormatData *imf, const bool stamp)
 
bool BKE_image_render_write (ReportList *reports, RenderResult *rr, const Scene *scene, const bool stamp, const char *filepath_basis)
 

Function Documentation

◆ BKE_image_render_write()

bool BKE_image_render_write ( ReportList reports,
RenderResult rr,
const Scene scene,
const bool  stamp,
const char *  filepath_basis 
)

◆ BKE_image_render_write_exr()

bool BKE_image_render_write_exr ( ReportList reports,
const RenderResult rr,
const char *  filepath,
const ImageFormatData imf,
const bool  save_as_render,
const char *  view,
int  layer 
)

◆ BKE_image_save()

bool BKE_image_save ( ReportList reports,
Main bmain,
Image ima,
ImageUser iuser,
const ImageSaveOptions opts 
)

◆ BKE_image_save_options_free()

void BKE_image_save_options_free ( ImageSaveOptions opts)

◆ BKE_image_save_options_init()

bool BKE_image_save_options_init ( ImageSaveOptions opts,
Main bmain,
Scene scene,
Image ima,
ImageUser iuser,
const bool  guess_path,
const bool  save_as_render 
)

Definition at line 76 of file image_save.cc.

References BKE_image_acquire_ibuf(), BKE_image_format_color_management_copy_from_scene(), BKE_image_format_from_imbuf(), BKE_image_format_init(), BKE_image_format_init_for_write(), BKE_image_is_multiview(), BKE_image_release_ibuf(), BKE_image_user_file_path_ex(), BKE_imageuser_default(), BKE_main_blendfile_path(), BLI_path_abs(), BLI_path_make_safe(), BLI_snprintf(), BLI_strncpy(), ImageSaveOptions::bmain, ImageFormatData::color_management, COLOR_ROLE_DEFAULT_BYTE, Image::colorspace_settings, ImageFormatData::depth, ELEM, ImageSaveOptions::filepath, G, Image::id, ImageSaveOptions::im_format, RenderData::im_format, IMA_SRC_GENERATED, IMA_SRC_TILED, IMA_SRC_VIEWER, IMB_colormanagement_role_colorspace_name_get(), IMB_colormanagement_space_name_is_data(), ImageFormatData::imtype, imtype_best_depth(), len, ImageFormatData::linear_colorspace_settings, lock, ColorManagedColorspaceSettings::name, ID::name, ImageFormatData::planes, ImageSaveOptions::prev_imtype, ImageSaveOptions::prev_save_as_render, ImageFormatData::quality, Scene::r, R_IMF_COLOR_MANAGEMENT_FOLLOW_SCENE, R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA, ImageSaveOptions::save_as_render, ImageSaveOptions::scene, scene, ImageUser::scene, Image::source, Image::stereo3d_format, ImageFormatData::stereo3d_format, STR_CONCAT, STREQ, STRNCPY, Image::views_format, and ImageFormatData::views_format.

Referenced by ED_image_save_all_modified(), image_save_as_init(), and image_save_exec().

◆ BKE_image_save_options_update()

void BKE_image_save_options_update ( ImageSaveOptions opts,
const Image image 
)

◆ image_exr_from_scene_linear_to_output()

static float* image_exr_from_scene_linear_to_output ( float rect,
const int  width,
const int  height,
const int  channels,
const ImageFormatData imf,
Vector< float * > &  tmp_output_rects 
)
static

◆ image_render_print_save_message()

static void image_render_print_save_message ( ReportList reports,
const char *  name,
int  ok,
int  err 
)
static

Definition at line 875 of file image_save.cc.

References BKE_reportf(), err, and RPT_ERROR.

Referenced by BKE_image_render_write(), and image_render_write_stamp_test().

◆ image_render_write_stamp_test()

static int image_render_write_stamp_test ( ReportList reports,
const Scene scene,
const RenderResult rr,
ImBuf ibuf,
const char *  name,
const ImageFormatData imf,
const bool  stamp 
)
static

◆ image_save_post()

static void image_save_post ( ReportList reports,
Image ima,
ImBuf ibuf,
int  ok,
const ImageSaveOptions opts,
int  save_copy,
const char *  filepath,
bool r_colorspace_changed 
)
static

◆ image_save_single()

static bool image_save_single ( ReportList reports,
Image ima,
ImageUser iuser,
const ImageSaveOptions opts,
bool r_colorspace_changed 
)
static
Returns
success.
Note
ima->filepath and ibuf->name should end up the same.
for multi-view the first ibuf is important to get the settings.

Definition at line 349 of file image_save.cc.

References BKE_image_acquire_ibuf(), BKE_image_acquire_renderresult(), BKE_image_format_to_imbuf(), BKE_image_is_stereo(), BKE_image_multilayer_index(), BKE_image_multiview_index(), BKE_image_release_ibuf(), BKE_image_release_renderresult(), BKE_image_render_write_exr(), BKE_imageuser_default(), BKE_imbuf_alpha_test(), BKE_imbuf_stamp_info(), BKE_imbuf_write_as(), BKE_report(), BKE_reportf(), BKE_scene_multiview_view_filepath_get(), BLI_findlink(), BLI_findstring(), BLI_findstringindex(), BLI_listbase_count(), BLI_listbase_count_at_most(), ELEM, FILE_MAX, ImageSaveOptions::filepath, ImageUser::flag, IB_BITMAPDIRTY, id, if(), ImageSaveOptions::im_format, IMA_SHOW_STEREO, IMA_TYPE_R_RESULT, image_save_post(), IMB_colormanagement_imbuf_for_write(), IMB_dupImBuf(), IMB_freeImBuf(), IMB_stereo3d_ImBuf(), imbuf_save_post(), ImageFormatData::imtype, ImageUser::layer, lock, names, ImBuf::planes, ImageFormatData::planes, Scene::r, R_IMF_IMTYPE_MULTILAYER, R_IMF_IMTYPE_OPENEXR, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA, R_IMF_VIEWS_INDIVIDUAL, R_IMF_VIEWS_MULTIVIEW, R_IMF_VIEWS_STEREO_3D, RE_HasFloatPixels(), ImBuf::rect, ImBuf::rect_float, RPT_ERROR, ImageSaveOptions::save_as_render, ImageSaveOptions::save_copy, ImageSaveOptions::scene, STEREO_LEFT_NAME, STEREO_RIGHT_NAME, Image::type, ImBuf::userflags, view, ImageUser::view, Image::views, RenderResult::views, and ImageFormatData::views_format.

Referenced by BKE_image_save().

◆ image_save_update_filepath()

static void image_save_update_filepath ( Image ima,
const char *  filepath,
const ImageSaveOptions opts 
)
static

◆ imbuf_save_post()

static void imbuf_save_post ( ImBuf ibuf,
ImBuf colormanaged_ibuf 
)
static

Definition at line 329 of file image_save.cc.

References ImBuf::foptions, ImBuf::ftype, IMB_freeImBuf(), and ImBuf::planes.

Referenced by image_save_single().

◆ imtype_best_depth()

static char imtype_best_depth ( ImBuf ibuf,
const char  imtype 
)
static