Skip to content

Commit

Permalink
[nodes] Blender: Rescale rendered images based on their pixel aspect …
Browse files Browse the repository at this point in the history
…ratio
  • Loading branch information
cbentejac committed Dec 14, 2023
1 parent 35b69f1 commit 283794f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions meshroom/nodes/blender/scripts/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,13 @@ def main():
setupRender(view, intrinsic, pose, args.output)
bpy.ops.render.render(write_still=True)

# if the pixel aspect ratio is not 1, reload and rescale the rendered image
if bpy.context.scene.render.pixel_aspect_x != 1.0:
final_img = bpy.data.images.load(bpy.context.scene.render.filepath)
final_img.scale(int(bpy.context.scene.render.resolution_x * bpy.context.scene.render.pixel_aspect_x), bpy.context.scene.render.resolution_y)
final_img.save()
bpy.data.images.remove(final_img)

# clear memory
if img:
bpy.data.images.remove(img)
Expand Down

0 comments on commit 283794f

Please sign in to comment.