47 memcpy(imf_dst, imf_src,
sizeof(*imf_dst));
70 format->linear_colorspace_settings.name);
74 if (format->linear_colorspace_settings.name[0] ==
'\0' || image_requires_linear != is_linear) {
96 format->media_type = media_type;
139 const bool is_render = (owner_id &&
GS(owner_id->
name) ==
ID_SCE);
155 if ((imf->
depth & depth_ok) == 0) {
161 Scene *scene =
reinterpret_cast<Scene *
>(owner_id);
215#ifdef WITH_IMAGE_CINEON
217 return IMB_FTYPE_CINEON;
220 return IMB_FTYPE_DPX;
223#ifdef WITH_IMAGE_OPENJPEG
225 r_options->
flag |= JP2_JP2;
226 return IMB_FTYPE_JP2;
229#ifdef WITH_IMAGE_WEBP
231 return IMB_FTYPE_WEBP;
268#ifdef WITH_IMAGE_CINEON
269 if (ftype == IMB_FTYPE_CINEON) {
272 if (ftype == IMB_FTYPE_DPX) {
283#ifdef WITH_IMAGE_OPENJPEG
284 if (ftype == IMB_FTYPE_JP2) {
288#ifdef WITH_IMAGE_WEBP
289 if (ftype == IMB_FTYPE_WEBP) {
426 const bool is_render_out = (owner_id &&
GS(owner_id->
name) ==
ID_SCE);
428 const Scene *scene = id_cast<const Scene *>(owner_id);
447 if (valid_depths & depth_ls[i]) {
456 if (
STREQ(imtype_arg,
"TGA")) {
459 if (
STREQ(imtype_arg,
"IRIS")) {
462 if (
STREQ(imtype_arg,
"JPEG")) {
465 if (
STREQ(imtype_arg,
"RAWTGA")) {
468 if (
STREQ(imtype_arg,
"PNG")) {
471 if (
STREQ(imtype_arg,
"BMP")) {
474 if (
STREQ(imtype_arg,
"HDR")) {
477 if (
STREQ(imtype_arg,
"TIFF")) {
480 if (
STREQ(imtype_arg,
"OPEN_EXR")) {
483 if (
STREQ(imtype_arg,
"OPEN_EXR_MULTILAYER")) {
486 if (
STREQ(imtype_arg,
"EXR")) {
489 if (
STREQ(imtype_arg,
"MULTILAYER")) {
493 if (
STREQ(imtype_arg,
"FFMPEG")) {
497#ifdef WITH_IMAGE_CINEON
498 if (
STREQ(imtype_arg,
"CINEON")) {
501 if (
STREQ(imtype_arg,
"DPX")) {
505#ifdef WITH_IMAGE_OPENJPEG
506 if (
STREQ(imtype_arg,
"JP2")) {
510#ifdef WITH_IMAGE_WEBP
511 if (
STREQ(imtype_arg,
"WEBP")) {
515 if (
STREQ(imtype_arg,
"AVIF")) {
532 r_ext[ext_num++] =
".rgb";
535 r_ext[ext_num++] =
".rgb";
538 r_ext[ext_num++] =
".hdr";
541 r_ext[ext_num++] =
".png";
544 r_ext[ext_num++] =
".dds";
547 r_ext[ext_num++] =
".tga";
550 r_ext[ext_num++] =
".bmp";
553 r_ext[ext_num++] =
".tif";
554 r_ext[ext_num++] =
".tiff";
557 r_ext[ext_num++] =
".psd";
560 r_ext[ext_num++] =
".exr";
562#ifdef WITH_IMAGE_CINEON
564 r_ext[ext_num++] =
".cin";
567 r_ext[ext_num++] =
".dpx";
570#ifdef WITH_IMAGE_OPENJPEG
574 r_ext[ext_num++] =
".jp2";
577 r_ext[ext_num++] =
".j2c";
580 BLI_assert_msg(0,
"Unsupported jp2 codec was specified in im_format->jp2_codec");
584 r_ext[ext_num++] =
".jp2";
588#ifdef WITH_IMAGE_WEBP
590 r_ext[ext_num++] =
".webp";
594 r_ext[ext_num++] =
".avif";
598 r_ext[ext_num++] =
".jpg";
599 r_ext[ext_num++] =
".jpeg";
602 r_ext[ext_num] =
nullptr;
618 const size_t filepath_maxncpy,
638 const size_t filepath_maxncpy,
645 const size_t filepath_maxncpy,
660 const bool use_frames,
663 if (filepath ==
nullptr) {
668 if (template_variables) {
670 filepath,
FILE_MAX, *template_variables);
672 return variable_errors;
683 const size_t len = strlen(filepath);
708 const bool use_frames,
731 const bool use_frames,
751 char imtype = imf->
imtype;
811#ifdef WITH_IMAGE_CINEON
813 ibuf->
ftype = IMB_FTYPE_CINEON;
828 ibuf->
ftype = IMB_FTYPE_DPX;
850#ifdef WITH_IMAGE_OPENJPEG
855 ibuf->
ftype = IMB_FTYPE_JP2;
883 BLI_assert_msg(0,
"Unsupported jp2 codec was specified in im_format->jp2_codec");
887#ifdef WITH_IMAGE_WEBP
889 ibuf->
ftype = IMB_FTYPE_WEBP;
950 int custom_flags =
imbuf->foptions.flag;
951 char quality =
imbuf->foptions.quality;
952 char compress =
imbuf->foptions.compress;
953 bool is_depth_set =
false;
1006 is_depth_set =
true;
1020#ifdef WITH_IMAGE_CINEON
1021 else if (ftype == IMB_FTYPE_CINEON) {
1024 else if (ftype == IMB_FTYPE_DPX) {
1029 if (custom_flags &
RAWTGA) {
1036#ifdef WITH_IMAGE_OPENJPEG
1037 else if (ftype == IMB_FTYPE_JP2) {
1041 if (custom_flags & JP2_16BIT) {
1043 is_depth_set =
true;
1045 else if (custom_flags & JP2_12BIT) {
1047 is_depth_set =
true;
1050 if (custom_flags & JP2_YCC) {
1054 if (custom_flags & JP2_CINE) {
1056 if (custom_flags & JP2_CINE_48FPS) {
1061 if (custom_flags & JP2_JP2) {
1064 else if (custom_flags & JP2_J2K) {
1068 BLI_assert_msg(0,
"Unsupported jp2 codec was specified in file type");
1072#ifdef WITH_IMAGE_WEBP
1073 else if (ftype == IMB_FTYPE_WEBP) {
1085 is_depth_set =
true;
1089 is_depth_set =
true;
1098 if (!is_depth_set) {
1136 const Scene *scene_src,
1138 const bool allow_video)
1140 *imf = (imf_src) ? *imf_src : scene_src->
r.
im_format;
Functions and classes for evaluating template expressions in filepaths.
#define TIF_COMPRESS_PACKBITS
#define TIF_COMPRESS_NONE
#define TIF_COMPRESS_DEFLATE
#define OPENEXR_CODEC_MASK
#define OPENEXR_MULTIPART
#define BLI_assert_unreachable()
#define BLI_assert_msg(a, msg)
CCL_NAMESPACE_BEGIN struct Options options
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
bool BKE_image_format_is_byte(const ImageFormatData *imf)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
static Vector< path_templates::Error > do_makepicstring(char filepath[FILE_MAX], const char *base, const char *relbase, const path_templates::VariableMap *template_variables, int frame, const char imtype, const ImageFormatData *im_format, const bool use_ext, const bool use_frames, const char *suffix)
void BKE_image_format_set(ImageFormatData *imf, ID *owner_id, const char imtype)
void BKE_image_format_media_type_set(ImageFormatData *format, ID *owner_id, const MediaType media_type)
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
void BKE_image_format_color_management_copy_from_scene(ImageFormatData *imf, const Scene *scene)
@ MEDIA_TYPE_MULTI_LAYER_IMAGE
void BKE_image_format_to_imbuf(ImBuf *ibuf, const ImageFormatData *imf)
void BKE_image_format_blend_write(BlendWriter *writer, ImageFormatData *imf)
BLI_INLINE bool BLI_path_slash_is_native_compat(const char ch)
static eImageFormatDepth imtype_best_depth(const ImBuf *ibuf, const char imtype)
bool bool BLI_path_suffix(char *path, size_t path_maxncpy, const char *suffix, const char *sep) ATTR_NONNULL(1
void BKE_color_managed_view_settings_init(ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, const char *view_transform)
void BKE_color_managed_colorspace_settings_copy(ColorManagedColorspaceSettings *colorspace_settings, const ColorManagedColorspaceSettings *settings)
eImbFileType BKE_imtype_to_ftype(char imtype, ImbFormatOptions *r_options)
bool BLI_path_frame(char *path, size_t path_maxncpy, int frame, int digits) ATTR_NONNULL(1)
@ R_IMF_COLOR_MANAGEMENT_OVERRIDE
void BKE_color_managed_display_settings_init(ColorManagedDisplaySettings *settings)
@ COLOR_ROLE_SCENE_LINEAR
@ COLOR_ROLE_DEFAULT_BYTE
static bool do_ensure_image_extension(char *filepath, const size_t filepath_maxncpy, const char imtype, const ImageFormatData *im_format)
Vector< bke::path_templates::Error > BKE_image_path_from_imformat(char *filepath, const char *base, const char *relbase, const bke::path_templates::VariableMap *template_variables, int frame, const ImageFormatData *im_format, bool use_ext, bool use_frames, const char *suffix)
void BKE_color_managed_view_settings_blend_read_data(BlendDataReader *reader, ColorManagedViewSettings *settings)
bool BKE_imtype_is_multi_layer_image(char imtype)
const char * imb_ext_image[]
void BKE_color_managed_view_settings_copy(ColorManagedViewSettings *new_settings, const ColorManagedViewSettings *settings)
eImageFormatDepth MOV_codec_valid_bit_depths(IMB_Ffmpeg_Codec_ID codec_id)
void BKE_image_format_from_imbuf(ImageFormatData *im_format, const ImBuf *imbuf)
bool BKE_imtype_supports_compress(char imtype)
bool BKE_imtype_is_image(char imtype)
int BKE_image_path_ext_from_imtype(const char imtype, const char *r_ext[BKE_IMAGE_PATH_EXT_MAX])
Vector< bke::path_templates::Error > BKE_path_apply_template(char *path, int path_maxncpy, const bke::path_templates::VariableMap &template_variables)
@ R_IMF_IMTYPE_MULTILAYER
bool BLI_path_extension_ensure(char *path, size_t path_maxncpy, const char *ext) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
static int image_path_ext_from_imformat_impl(const char imtype, const ImageFormatData *im_format, const char *r_ext[BKE_IMAGE_PATH_EXT_MAX])
void BKE_color_managed_display_settings_copy(ColorManagedDisplaySettings *new_settings, const ColorManagedDisplaySettings *settings)
const char * IMB_colormanagement_role_colorspace_name_get(int role)
@ R_IMF_JP2_FLAG_CINE_PRESET
void IMB_colormanagement_colorspace_settings_set(ColorManagedColorspaceSettings *settings, const char *name)
void BKE_image_format_blend_read_data(BlendDataReader *reader, ImageFormatData *imf)
bool BKE_imtype_supports_quality(char imtype)
int BKE_image_path_ext_from_imformat_ensure(char *filepath, size_t filepath_maxncpy, const ImageFormatData *im_format)
bool BLI_path_extension_replace(char *path, size_t path_maxncpy, const char *ext) ATTR_NONNULL(1
void BKE_image_format_init(ImageFormatData *imf)
void BKE_color_managed_colorspace_settings_init(ColorManagedColorspaceSettings *colorspace_settings)
void BKE_image_format_color_management_copy(ImageFormatData *imf, const ImageFormatData *imf_src)
eImageFormatDepth BKE_imtype_valid_depths(char imtype)
void BKE_image_format_free(ImageFormatData *imf)
void BKE_image_format_init_for_write(ImageFormatData *imf, const Scene *scene_src, const ImageFormatData *imf_src, const bool allow_video=false)
bool BKE_imtype_requires_linear_float(char imtype)
bool BKE_imtype_is_movie(char imtype)
char BKE_ftype_to_imtype(eImbFileType ftype, const ImbFormatOptions *options)
eImageFormatDepth BKE_imtype_first_valid_depth(eImageFormatDepth valid_depths)
void MOV_validate_output_settings(RenderData *rd, const ImageFormatData *imf)
bool BLI_path_extension_check_array(const char *path, const char **ext_array) ATTR_NONNULL(1
char BKE_imtype_from_arg(const char *imtype_arg)
ID_Type GS(const char *name)
Vector< bke::path_templates::Error > BKE_image_path_from_imtype(char *filepath, const char *base, const char *relbase, const bke::path_templates::VariableMap *template_variables, int frame, char imtype, bool use_ext, bool use_frames, const char *suffix)
@ R_IMF_EXR_FLAG_MULTIPART
void BKE_color_managed_view_settings_free(ColorManagedViewSettings *settings)
void BKE_color_managed_view_settings_blend_write(BlendWriter *writer, const ColorManagedViewSettings *settings)
char BKE_imtype_valid_channels(char imtype)
bool IMB_colormanagement_space_name_is_data(const char *name)
void BKE_image_format_update_color_space_for_type(ImageFormatData *format)
int BKE_image_path_ext_from_imtype_ensure(char *filepath, size_t filepath_maxncpy, char imtype)
int BKE_image_path_ext_from_imformat(const ImageFormatData *im_format, const char *r_ext[BKE_IMAGE_PATH_EXT_MAX])
eImageFormatDepth BKE_imtype_valid_depths_with_video(char imtype, const ID *owner_id)
void BKE_image_format_copy(ImageFormatData *imf_dst, const ImageFormatData *imf_src)
bool IMB_colormanagement_space_name_is_scene_linear(const char *name)
@ R_IMF_TIFF_CODEC_DEFLATE
@ R_IMF_TIFF_CODEC_PACKBITS
ImbFormatOptions foptions
const float * float_data() const
ImageFormatData im_format
struct FFMpegCodecData ffcodecdata
ColorManagedViewSettings view_settings
ColorManagedDisplaySettings display_settings