I want to know the width and the height of my camera in blender-units.


Therefore I've written a small script:

import bpy

camera = bpy.context.selected_objects[0]


But all I get is 0. Is there any other way to get the dimensions?


3 Answers 3


As far as I know camera objects don't have geometry, and hence no real world Blender Units dimensions.

The viewport size of a camera object depends on a variety of combined factors.

  1. The camera object size reflects the render resolution set in the render properties panel, changing proportions according to the image size.
  2. Visual scaling factor, controlled by the Size property in the Object Data panel > Viewport Display > Size.
  3. The Focal Length will also affect the camera shape by adjusting the angle of the sides to reflect the current view field.
  4. Lastly the Camera Shift X and Shift Y properties will skew its shape to reflect the applied panning effect.

enter image description here

As pointed out by Jaroslav Jerryno Novotny you can get camera corners from the python API with camera_obj.data.view_frame.

For more info see https://blender.stackexchange.com/a/28561/7777

  • 1
    $\begingroup$ You should be able to find it in the code that actually draws the camera in the 3D viewport. $\endgroup$
    – dr. Sybren
    Commented Dec 7, 2017 at 11:57
  • 1
    $\begingroup$ the camera corners are stored in camera_obj.data.view_frame, full code: blender.stackexchange.com/a/28561/7777 $\endgroup$ Commented Apr 8, 2021 at 12:29
  • $\begingroup$ @Hey nice one, I'll add that to the answer. Thanks $\endgroup$ Commented Apr 8, 2021 at 14:01

Script version.

import bpy
from bpy import context

scene = context.scene
cam = scene.camera
mw = cam.matrix_world

f = 1 if cam.type == 'ORTHO' else cam.data.display_size

corners = [mw @ (f * p) for p in cam.data.view_frame(scene=scene)]

# add empties at corners
for i, p in enumerate(corners):
    context.object.name = f"MT{i}"

w = corners[3] - corners[0]
h = corners[1] - corners[0]

print(f"Camera: {cam.name} dimensions {w.length : .2f} x {h.length : .2f}")

For default file.

Camera: Camera dimensions  1.00 x  0.56

default file, camera switched to ORTHO

Camera: Camera dimensions  7.31 x  4.11


bpy: How do you find the corners of a camera frustum?

Getting edges of the camera's view on the scene XY plane

Constrain a camera to an object while also aligning it perfectly to the center of the object (relative to the camera) even while using perspective

Pre 2.8



I don't know anything about coding... but right-clicking on the Size value under Viewport Display and choosing "Copy Data Path" tells me the value is called display_size. Maybe this helps; I don't know how to address this in python. Anyway, from this value you can calculate the viewport camera dimensions according to these rules (if the camera scale is set to 1):

The Size value you set for the Viewport Display is the width of the displayed camera, the height is according to the render size aspect ratio.

So if the render size is 1920 x 1080 for example (i.e. 16:9), and the camera size is set to 2 meters, then the height is 2m x 9/16 = 1.125 m.

The "length" of the camera is the Viewport Display Size multiplied by the ratio between Sensor Size and Focal Length.

With a camera size set to 2 meters, let's say the Focal Length is 50mm and the Sensor Size is the default 36mm, then the displayed camera length is 2m x 50/36 = 2.777...m.

EDIT, just for completion: The Shift X and Shift Y values are the factor how much of the width size the camera is shifted to the right (X, left if negative) and upwards (Y, downwards if negative) from the camera origin along its length.

So, with the previous example values this means, if you set Shift X = 1 and Shift Y = 0.5, the 2m x 1.125m frame is 2.7778m away from the origin position and shifted 2m x 1 = 2m to the right and 2m x 0.5 = 1m upwards.

I've uploaded a file where a plane is parented to the camera and drivers positioning it to the camera frame so you can see the dependencies.

camera plane


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .