Cropping view perfectly to geometry when animating

I’m writing a script that must output square images. If I make a square in grasshopper and zoom to it, then animate in top view, the resulting images have a border. Is there a (scripted) way to circumvent this? A minimal example is attached: if you zoom to the red square geometry and run an animation, you’ll see the green outline and some of the background, which is undesirable. The outline won’t be present in the final script; it is just there for debugging.

Ideally I could automatically generate the correct view which will output the perfectly cropped square. The dimensions of the square will always be an input and won’t change during the animation.

the output looks like this:
square2_00009
It should look basically like this:
square3_00009

animation_cropping3.gh (9.5 KB)

missing

That yellow (green?) border is from the Scale output, disable it?

I do my cropping in GIMP after ‘File | Open as Layers…’ where anything extraneous can easily be ignored.

P.S. Or maybe you are animating the Scale ‘F’ slider input? In that case, you should set the slider maximum value appropriately so animate won’t exceed your desired limits.

EDIT: Updated again in the original post with native gh components… forgot a Y input for the square.

  • The slider animates the colour of the red square. The square doesn’t change in size. For the purposes of this question I’m not concerned with the animation per se but the cropping of the view.
  • The green outline is not part of the final script and I’m not zooming to it when I establish the view. (I zoom to the square preview). The outline won’t be present in the final script. It is just there for debugging. It helps me visually determine that the cropping is not close enough.
  • Looking to do this in grasshopper. Python, other plugins etc I’m open to… I guess precisely defining a view in Rhino is okay but I don’t see a consistent way to do this given a square of a defined dimension.

It’s REALLY EASY to crop the stack of layers in GIMP when producing the animated GIF. (but an image that is 400 X 4 units is a weird form factor, so I changed that)

GIMP is a great program, but this is a minimal example that is part of a larger workflow so I’m looking to do this in gh.

Do what exactly? Do you mean modify the dimensions of the Rhino ‘Top’ view? Pardon me then, I’ll leave that to someone way above my pay grade. I don’t understand.