After Toolkit > Modifiers > Crop
Make one cropped precomp out of multiple layers
Crop your compositions or make one cropped precomp out of multiple layers.Crop trims your composition's dimensions to your layers' edges, or creates a cropped precomp layer with all of your selected layers in it.
Crop - Quickstart Guide
Open your After Toolkit, select your layers, and click on Crop.Select your Cropping Method: You can either make a precomp of your selected layers, or crop your active composition to your layers' edges.
If you opt for making a precomp, enter your new Precomp Name. The name of your first selected layer will be the default option.
If any of your selected layers has a parent layer, you can select which parent your precomp should keep as a parent with the Parent precomp to dropdown menu.
If you check the Make one Precomp per Layer box, each precomp will be named after its original layer.
If your layers have parents, your output precomps will keep the same parents.
Extra Padding will add margins all around each precomposed layer.
The second option is to crop your active composition.
By default it will crop your current composition by resizing it to all of your layers' edges.
You can also pick what type of layer you want the cropping operation to include or ignore.
The Preview button generates a guide layer to show you exactly what the end result will be.
Everytime you apply custom settings, they are saved for the next time you use it again. Reset to default values will revert to original settings, before you ran it for the first time.