mirror of
https://github.com/blender/blender
synced 2026-10-25 03:07:01 +03:00
The bug happened because the PNG file contained Exif:ColorSpace set to
1 = sRGB, which was preserved in the tx file along with other metadata.
Now we strip that since it's could also cause problems opening the tx
file directly in other software. But the actual bugfix is different.
To more properly fix this, we revert 5d2b8f8a52. The problem is that
TIFF files can not store arbitrary colorspace metadata, so we can not
rely on it even if it works for that test file now. Instead we match
the maketx logic to find the colorspace that the tx file was saved in,
based on the colorspace of the original image file.
New tests added that load images in various color spaces into a blend
file with Linear Rec.709 and ACEScg colorspace. All should render
identical to each other and between the working spaces (within available
precision). Except for the data color space images which do not get
converted at all, but should look identical with texture cache on/off.
Pull Request: https://projects.blender.org/blender/blender/pulls/161135
39 lines
1.1 KiB
C++
39 lines
1.1 KiB
C++
/* SPDX-FileCopyrightText: 2025 OpenImageIO project
|
|
* 2026 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
* This is a modified version of maketexture.cpp from OpenImageIO, to add a few
|
|
* features missing in the native implementation. */
|
|
|
|
#pragma once
|
|
|
|
#include <cstdlib>
|
|
#include <string>
|
|
|
|
#include "util/image_metadata.h"
|
|
#include "util/param.h"
|
|
#include "util/string.h"
|
|
#include "util/types_image.h"
|
|
|
|
CCL_NAMESPACE_BEGIN
|
|
|
|
#define TX_FILE_FORMAT_VERSION 0
|
|
|
|
bool resolve_tx(const string &filepath,
|
|
const string &texture_cache_path,
|
|
ustring colorspace,
|
|
const ImageAlphaType alpha_type,
|
|
const ImageFormatType format_type,
|
|
std::string &out_filepath,
|
|
ImageMetaData &out_metadata);
|
|
|
|
bool make_tx(const string &filepath,
|
|
const string &out_filepath,
|
|
ustring colorspace,
|
|
const ImageAlphaType alpha_type,
|
|
const ImageFormatType format_type);
|
|
|
|
ustring make_tx_get_file_colorspace(const ImageMetaData &metadata);
|
|
|
|
CCL_NAMESPACE_END
|