Aspect Ratio not saved in EXRs / Metadata #105015

Open
opened 2023-02-21 12:05:27 +01:00 by Steffen Dünner · 4 comments

System Information
Operating system: Linux-5.15.0-60-generic-x86_64-with-glibc2.35 64 Bits
Graphics card: NVIDIA GeForce RTX 2070 Super/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 525.85.12

Blender Version
Broken: version: 3.6.0 Alpha, branch: main, commit date: 2023-02-21 10:16, hash: 6eccea7a6f70
Worked: (newest version of Blender that worked as expected)

Short description of error
The Pixel Aspect Ratio is not saved in the metadata of EXR (or any other image file format).
If I render for an anamorphic target (in my case with a squeeze factor of 2), the pixel aspect is not saved in the metadata which makes compositing a tiny bit more tedious afterwards because I have to take care of the aspect ratio by hand.

If I call exrheader to show the metadata I get

pixelAspectRatio (type float): 1

which obviously should be "2". I double-checked with files coming from Resolve and from an ARRI RAW converter.

On a side note: In Blender non-square pixels are supported fine except for the Compositor Backdrop that doesn't offer an aspect ratio correction, but that is another report.

Exact steps for others to reproduce the error

  • Open the attached blend file
  • Click on "Render Animation" (or press CTRL+F12). It'll render an image of 3 Suzannes and write an EXR called "Aspect.0001.exr"
  • Check the attached metadata (either with 'exrheader' or any other tool that reads EXR metadata.
**System Information** Operating system: Linux-5.15.0-60-generic-x86_64-with-glibc2.35 64 Bits Graphics card: NVIDIA GeForce RTX 2070 Super/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 525.85.12 **Blender Version** Broken: version: 3.6.0 Alpha, branch: main, commit date: 2023-02-21 10:16, hash: `6eccea7a6f70` Worked: (newest version of Blender that worked as expected) **Short description of error** The Pixel Aspect Ratio is not saved in the metadata of EXR (or any other image file format). If I render for an anamorphic target (in my case with a squeeze factor of 2), the pixel aspect is not saved in the metadata which makes compositing a tiny bit more tedious afterwards because I have to take care of the aspect ratio by hand. If I call exrheader to show the metadata I get ``` pixelAspectRatio (type float): 1 ``` which obviously should be "2". I double-checked with files coming from Resolve and from an ARRI RAW converter. On a side note: In Blender non-square pixels are supported fine except for the Compositor Backdrop that doesn't offer an aspect ratio correction, but that is another report. **Exact steps for others to reproduce the error** - Open the attached blend file - Click on "Render Animation" (or press CTRL+F12). It'll render an image of 3 Suzannes and write an EXR called "Aspect.0001.exr" - Check the attached metadata (either with 'exrheader' or any other tool that reads EXR metadata.
Steffen Dünner added the
Priority
Normal
Type
Report
Status
Needs Triage
labels 2023-02-21 12:05:28 +01:00
Member

Thanks for the report. I can confirm

Thanks for the report. I can confirm
Pratik Borhade added
Status
Confirmed
Interest
Images & Movies
and removed
Status
Needs Triage
labels 2023-02-24 06:28:49 +01:00
Philipp Oeser added the
Module
Core
label 2023-03-17 14:40:10 +01:00
Member

For testing, the file as made by the above instructions:

Aspect.0001.exr

The output from exiftool:

ExifTool Version Number         : 12.58
File Name                       : Aspect.0001.exr
Directory                       : C:/Users/Harley/Downloads
File Size                       : 382 kB
File Modification Date/Time     : 2023:03:17 13:42:44-07:00
File Access Date/Time           : 2023:03:17 13:42:44-07:00
File Creation Date/Time         : 2023:03:17 13:42:43-07:00
File Permissions                : -rw-rw-rw-
File Type                       : EXR
File Type Extension             : exr
MIME Type                       : image/x-exr
EXR Version                     : 2
Flags                           : Long names
Camera                          : Camera
Date                            : 2023/03/17 13:42:43
File                            : C:\Users\Harley\Downloads\BUG_Aspect_Ratio_v01.blend
Frame                           : 1
Frame Range                     : 1:1
Hostname                        : OFFICE
Lens                            : 50.00
Marker                          : <none>
Memory                          : 79.60M
Render Time                     : 00:18.02
Scene                           : Scene
Strip                           : <none>
Time                            : 00:00:00:01
Channels                        : ViewLayer.Combined.A half 1 1, ViewLayer.Combined.B half 1 1, ViewLayer.Combined.G half 1 1, ViewLayer.Combined.R half 1 1
Compression                     : Unknown (9)
Cycles View Layer Render Time   : 00:17.93
Cycles View Layer Samples       : 4096
Cycles View Layer Synchronization Time: 00:00.05
Cycles View Layer Total Time    : 00:17.99
Data Window                     : 0 0 1919 1079
Display Window                  : 0 0 1919 1079
Line Order                      : Increasing Y
Pixel Aspect Ratio              : 1
Screen Window Center            : 0 0
Screen Window Width             : 1
Image Width                     : 1920
Image Height                    : 1080
Image Size                      : 1920x1080
Megapixels                      : 2.1

Above showing Pixel Aspect Ratio of 1 when it was rendered at 1920x1080 with an X Aspect of 2.0 and Y Aspect of 1.0. With metadata like "Cycles View Layer Samples" already it probably wouldn't be too hard to figure out how to add Pixel Aspect Ratio.

For testing, the file as made by the above instructions: [Aspect.0001.exr](/attachments/4479cdb2-dbc1-41e5-a6be-fbcb5035fb5b) The output from exiftool: ``` ExifTool Version Number : 12.58 File Name : Aspect.0001.exr Directory : C:/Users/Harley/Downloads File Size : 382 kB File Modification Date/Time : 2023:03:17 13:42:44-07:00 File Access Date/Time : 2023:03:17 13:42:44-07:00 File Creation Date/Time : 2023:03:17 13:42:43-07:00 File Permissions : -rw-rw-rw- File Type : EXR File Type Extension : exr MIME Type : image/x-exr EXR Version : 2 Flags : Long names Camera : Camera Date : 2023/03/17 13:42:43 File : C:\Users\Harley\Downloads\BUG_Aspect_Ratio_v01.blend Frame : 1 Frame Range : 1:1 Hostname : OFFICE Lens : 50.00 Marker : <none> Memory : 79.60M Render Time : 00:18.02 Scene : Scene Strip : <none> Time : 00:00:00:01 Channels : ViewLayer.Combined.A half 1 1, ViewLayer.Combined.B half 1 1, ViewLayer.Combined.G half 1 1, ViewLayer.Combined.R half 1 1 Compression : Unknown (9) Cycles View Layer Render Time : 00:17.93 Cycles View Layer Samples : 4096 Cycles View Layer Synchronization Time: 00:00.05 Cycles View Layer Total Time : 00:17.99 Data Window : 0 0 1919 1079 Display Window : 0 0 1919 1079 Line Order : Increasing Y Pixel Aspect Ratio : 1 Screen Window Center : 0 0 Screen Window Width : 1 Image Width : 1920 Image Height : 1080 Image Size : 1920x1080 Megapixels : 2.1 ``` Above showing Pixel Aspect Ratio of 1 when it was rendered at 1920x1080 with an X Aspect of 2.0 and Y Aspect of 1.0. With metadata like "Cycles View Layer Samples" already it probably wouldn't be too hard to figure out how to add Pixel Aspect Ratio.
Member

This looks to be us not setting a value for the OpenEXR file's HEADER member pixelAspectRatio (defined in ImfHeader.h) which then just uses the default value of 1.

We read the HEADER's pixelAspectRatio when reading EXRs (imb_load_openexr) for the calculation of ImBuf's ppm, but not seeing a suitable place to write this. Would appreciate another set of eyes on this.

This looks to be us not setting a value for the OpenEXR file's HEADER member `pixelAspectRatio` (defined in ImfHeader.h) which then just uses the default value of 1. We **read** the HEADER's pixelAspectRatio when reading EXRs (imb_load_openexr) for the calculation of ImBuf's ppm, but not seeing a suitable place to **write** this. Would appreciate another set of eyes on this.
Member

I don't have enough knowlege here to help much. But to me this looks like we store this information in RenderData as xasp, yasp and it is used during rendering. But we don't keep this information around after the render is complete in RenderResult. The Render struct contains pointers to both RenderData and RenderResult so there is probably some obvious place when this information could be copied.

Once it is in RenderResult it looks fairly easy to update the EXR header by perhaps sending it as an argument to IMB_exr_begin_write since BKE_image_render_write_exr has RenderResult. Would end up with something like header.pixelAspectRatio() = pixelAspectRatio;

I don't have enough knowlege here to help much. But to me this looks like we store this information in RenderData as xasp, yasp and it is used during rendering. But we don't keep this information around after the render is complete in RenderResult. The Render struct contains pointers to both RenderData and RenderResult so there is probably some obvious place when this information could be copied. Once it is in RenderResult it looks fairly easy to update the EXR header by perhaps sending it as an argument to IMB_exr_begin_write since BKE_image_render_write_exr has RenderResult. Would end up with something like `header.pixelAspectRatio() = pixelAspectRatio;`
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#105015
No description provided.