Skip to content

Commit

Permalink
[keyframe] Specify the input's colorspace when it is sRGB
Browse files Browse the repository at this point in the history
JPG images are always supposed to be in sRGB. When this information is
available, it is better to include it in the "fromColorSpace" when writing
the output to ensure the colorspace is appropriate.
  • Loading branch information
cbentejac committed Mar 9, 2023
1 parent 9ad5f60 commit c2148b4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/aliceVision/keyframe/KeyframeSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ bool KeyframeSelector::writeSelection(const std::vector<std::string>& brands,
inputSpec.extra_attribs = image::readImageMetadata(currentImgName);
int orientation = inputSpec.get_int_attribute("Orientation", 1);
float pixelAspectRatio = inputSpec.get_float_attribute("PixelAspectRatio", 1.0f);
std::string colorspace = inputSpec.get_string_attribute("oiio:Colorspace", "");

oiio::ParamValueList metadata;
metadata.push_back(oiio::ParamValue("Make", brands[id]));
Expand All @@ -479,6 +480,9 @@ bool KeyframeSelector::writeSelection(const std::vector<std::string>& brands,
options.fromColorSpace(image::EImageColorSpace::SRGB);
options.toColorSpace(image::EImageColorSpace::AUTO);
} else { // Otherwise, the frames have been read without any conversion, they should be written as such
if (colorspace == "sRGB")
options.fromColorSpace(image::EImageColorSpace::SRGB);

if (outputExtension == "exr")
options.toColorSpace(image::EImageColorSpace::NO_CONVERSION);
else
Expand Down

0 comments on commit c2148b4

Please sign in to comment.