ImageAutocrop

26 views
Skip to first unread message

Carlo Giesa

unread,
Feb 6, 2026, 1:12:36 PMFeb 6
to gaffer-dev
Hi there!

Before I go down the rabbit hole to write my own tool that 'autocrops' multi-layer 3D renders (currently, Arnold has a bug writing out autocropped, multi-layer EXRs), I wonder if there is anything in Gaffer for this.

Or maybe, it might be much simpler to write a Gaffer image node that does this.

With autocrop, I understand to compute the minimal data window of each layer that contains all pixels with values different than 0.

And I have another question in regards to this: In the ImageWrite, I see the option "Match Data Windows" and tells me that Nuke doesn't manage different data windows for multiple layers. Is that still a thing? And the tooltip mentions multi-view images. Does this apply for multi-layer as well?

Thanks for your input!
Carlo

John Haddon

unread,
Feb 9, 2026, 5:58:16 AM (11 days ago) Feb 9
to gaffe...@googlegroups.com
Hi Carlo!

On Fri, Feb 6, 2026 at 6:12 PM 'Carlo Giesa' via gaffer-dev <gaffe...@googlegroups.com> wrote:
Before I go down the rabbit hole to write my own tool that 'autocrops' multi-layer 3D renders (currently, Arnold has a bug writing out autocropped, multi-layer EXRs), I wonder if there is anything in Gaffer for this.
 
I don't think we have anything built in to Gaffer to do this already. 
 
Or maybe, it might be much simpler to write a Gaffer image node that does this.

I think it's probably quite easy to do this with OIIO on the command line, but it would be nice to have the functionality built into Gaffer too. It could either be its own node, or it might make sense just as an additional AreaSource on the existing Crop node, or as an additional output on the ImageStats node. I could give you some pointers if you're interested in giving it a go.
 
With autocrop, I understand to compute the minimal data window of each layer that contains all pixels with values different than 0.

In Gaffer, all layers (AOVs) share the same data window. It's views (think stereo left/right pairs) that can have different data windows. A view is basically a different image stream entirely, by virtue of having a different value for the `image:viewName` context variable.
 
And I have another question in regards to this: In the ImageWrite, I see the option "Match Data Windows" and tells me that Nuke doesn't manage different data windows for multiple layers. Is that still a thing? And the tooltip mentions multi-view images. Does this apply for multi-layer as well?

Daniel may know more here, but that plug was added when we added multi-view support, so I believe Nuke's limitation is specific to multi-view rather than multi-layer. This was three years ago - I don't know if it has been fixed in Nuke since.
 
Cheers...
John

Carlo Giesa

unread,
Feb 9, 2026, 8:14:19 AM (11 days ago) Feb 9
to gaffe...@googlegroups.com
Hey John!

Thanks for your feedback. Yes, indeed, oiiotool has the --autotrim flag that does what I need.

But maybe, I'll take a look anyway into how to implement this into Gaffer, just as an exercise. I'll come back to you if I need some pointers to start with.

Greets,
Carlo

--
You received this message because you are subscribed to the Google Groups "gaffer-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gaffer-dev+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/gaffer-dev/CAB8pVgKQFKRakGJbp794fAwLiZUAsDs8w8gC%2BU3Dj8nr6i8KVw%40mail.gmail.com.

John Haddon

unread,
Feb 10, 2026, 9:12:12 AM (10 days ago) Feb 10
to gaffe...@googlegroups.com

Carlo Giesa

unread,
Feb 10, 2026, 9:34:58 AM (10 days ago) Feb 10
to gaffe...@googlegroups.com
Haha!

I feel very honoured being mentioned in a Gaffer issue! That looks great. Thanks a lot.

Greets,
Carlo

Reply all
Reply to author
Forward
0 new messages