Thursday, March 3, 2016

Nuke - Reformat to Bounding Box Size

Sometimes we have weird formats to work with in Nuke like this:

Occasionally we want to reformat an image to the size of another image. In that situation we have to choose the format from the format list (output format).


There are a lot of formats shipped with Nuke and we can also add custom formats via python or do it manually. We can add these customizations to the menu.py to use as a default startup. When we read an image sequence which has a format which is not included in the predefined format list we will find that on the bottom of the list as an unnamed item with it's size (for eg. 5184x3456 as we can see):


 But using Refomat or Crop node can produce even more specific formats like the first image (2074x5184). There are couple of ways to use that format in the graph. I found that the easiest way is the following:

Using a CopyBBox node can copy the bounding box infromation to another branch of the graph. The Reformat node can use that info just have to use a simple expression. So the reformat type is "to box" and the width/height are the following expressions:
box_width = bbox.w
box_height = bbox.h


So the Noise node after that Reformat will have the same size: