nuke.Format

class nuke.Format

Bases: pybind11_object

A Format.

Construct an empty format. Construct a format with width, height, x, y, r, t and optional pixel aspect ratio.

Methods

add

self.add(name) -> None

fromUV

self.fromUV(u, v) -> [x, y]

height

self.height() -> int

name

self.name() -> string

pixelAspect

self.pixelAspect() -> float

r

self.r() -> int

scaled

scaled(sx, sy, tx, ty) -> Format

setHeight

self.setHeight(newHeight) -> None

setName

self.setName(name) -> None

setPixelAspect

self.setPixelAspect(aspectRatio) -> None

setR

self.setR(newR) -> None

setT

self.setT(newT) -> None

setWidth

self.setWidth(newWidth) -> None

setX

self.setX(newX) -> None

setY

self.setY(newY) -> None

t

self.t() -> int

toUV

self.toUV(x, y) -> (u, v)

width

self.width() -> int

x

self.x() -> int

y

self.y() -> int

add(name) → None

Add this instance to a list of “named” formats. The name parameter is the name of the list to add the format to.

fromUV(u, v) → [x, y]

Transform a UV coordinate in the range 0-1 into the format’s XY range. Returns a list containing the x and y coordinates.

Parameters:
  • u – The U coordinate.

  • v – The V coordinate.

Returns:

[x, y]

height() → int

Return the height of image file in pixels.

name() → string

Returns the user-visible name of the format.

pixelAspect() → float

Returns the pixel aspect ratio (pixel width divided by pixel height) for this format.

r() → int

Return the right edge of image file in pixels.

scaled(sx, sy, tx, ty) → Format

Scale and translate this format by sx, sy, tx and ty.

Parameters:
  • sx – Scale factor in X.

  • sy – Scale factor in Y.

  • tx – Offset factor in X.

  • ty – Offset factor in Y.

Returns:

Format.

setHeight(newHeight) → None

Set the height of image file in pixels. newHeight is the new height for the image; it should be a positive integer.

setName(name) → None

Set name of this format. The name parameter is the new name for the format.

setPixelAspect(aspectRatio) → None

Set a new pixel aspect ratio for this format. The aspectRatio parameter is the new ratio, found by dividing the desired pixel width by the desired pixel height.

setR(newR) → None

Set the right edge of image file in pixels. newR is the new right edge for the image; it should be a positive integer.

setT(newT) → None

Set the top edge of image file in pixels. newY is the new top edge for the image; it should be a positive integer.

setWidth(newWidth) → None

Set the width of image file in pixels.newWidth is the new width for the image; it should be a positive integer.

setX(newX) → None

Set the left edge of image file in pixels. newX is the new left edge for the image; it should be a positive integer.

setY(newY) → None

Set the bottom edge of image file in pixels. newY is the new bottom edge for the image; it should be a positive integer.

t() → int

Return the top edge of image file in pixels.

toUV(x, y)

Back-transform an XY coordinate in the format’s space into UV space.

Parameters:
  • x – The X coordinate.

  • y – The Y coordinate.

Returns:

[u, v].

width() → int

Return the width of image file in pixels.

x() → int

Return the left edge of image file in pixels.

y() → int

Return the bottom edge of image file in pixels.