[BUG] OpenEXR PixelAspectRatio
维护者通常 3 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- cpp
调研方向
先从提供的 ImageSpec::attribute 和 get_float_attribute 复现开始,然后跟踪 ImageOutput::create/OpenEXR 的写入路径以及 ImageInput::open 的元数据读回过程。比较已保存图像中的 string 和 float PixelAspectRatio 值;当从重新打开的 ImageSpec 中读取时,两种形式都能保留值 2,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
The PixelAspectRatio metadata is not always propagated in the right way to an exr image whether it is set as a float or as a string.
It must be set as a float to be correctly propagated.
However, when reading back as a float in the image spec, just after the setting as a string, the returned value is correct.
To Reproduce
Switch the 2 commented lines of the following code between setting as a float and setting as a string.
const std::string filename = "simple.exr";
const int xres = 320, yres = 240, channels = 3;
float pixels[xres * yres * channels] = { 0.5f };
std::unique_ptr<OIIO::ImageOutput> out = OIIO::ImageOutput::create(filename);
if (out)
{
std::cout << "save exr file ..." << std::endl;
OIIO::ImageSpec spec_out(xres, yres, channels, OIIO::TypeDesc::FLOAT);
float par = 2.0f;
spec_out.attribute("PixelAspectRatio", par);
//std::string par = "2.0";
//spec_out.attribute("PixelAspectRatio", par);
float par_read = spec_out.get_float_attribute("PixelAspectRatio", 4.0);
std::cout << "PAR read in image spec before saving: " << par_read << std::endl;
out->open(filename, spec_out);
out->write_image(OIIO::TypeDesc::FLOAT, pixels);
out->close();
std::unique_ptr<OIIO::ImageInput> in(OIIO::ImageInput::open(filename));
if (in)
{
std::cout << "read exr file metadata ..." << std::endl;
OIIO::ImageSpec spec_in = in->spec();
in->close();
float parFromNewImage;
spec_in.getattribute("PixelAspectRatio", OIIO::TypeDesc::FLOAT, &parFromNewImage);
std::cout << "PAR read in image spec of saved image: " << parFromNewImage << std::endl;
}
else
{
std::cout << "cannot read the new exr file !!!" << std::endl;
}
}
else
{
std::cout << "cannot create a new exr file !!!" << std::endl;
}
Expected behavior
What we get when setting as a float (expected behavior):
save exr file ...
PAR read in image spec before saving: 2
read exr file metadata ...
PAR read in image spec of saved image: 2
Evidence
What we get when setting as a string:
save exr file ...
PAR read in image spec before saving: 2
read exr file metadata ...
PAR read in image spec of saved image: 1
Platform information:
- OIIO branch/version: pick up from vcpkg
- OS: Windows
- C++ compiler: Visual Studio 2022
- Any non-default build flags when you build OIIO:
- 主要语言
- C++
- 星标
- 2.4k
- 派生
- 727
- 平均合并
- 4 天 8 小时
- 30 天内合并 PR
- 67
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
AcademySoftwareFoundation/OpenImageIO 的其他 Issue
-
bug: Python ImageBuf.get_pixels(oiio.UNKNOWN) returns None silently or segfaults可能重新可做 @stevwya77 于 10 天前认领,目前没有进行中的 PR。 未关闭bug good first issue python
难度 3/5 1-2 天 新手友好度 68/100
AcademySoftwareFoundation/OpenImageIO#5698 · 3 条评论 ·
维护者通常 3 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
AcademySoftwareFoundation/OpenImageIO#5619 · 2 条评论 ·
维护者通常 3 天内回复
-
难度 5/5 一周以上 新手友好度 10/100
AcademySoftwareFoundation/OpenImageIO#5570 ·
维护者通常 3 天内回复
-
难度 5/5 一周以上 新手友好度 35/100
AcademySoftwareFoundation/OpenImageIO#5558 ·
维护者通常 3 天内回复
-
define which color metadata OpenImageIO trusts, and when it resolves it可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 5/5 一周以上 新手友好度 20/100
AcademySoftwareFoundation/OpenImageIO#5516 ·
维护者通常 3 天内回复
查看 AcademySoftwareFoundation/OpenImageIO 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
component: tabs platform: macOS
难度 2/5 1-3 小时 新手友好度 72/100
zen-browser/desktop#16860 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
windirstat/windirstat#776 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
godotengine/godot#125913 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100