This script will remove all empty layers and sublayers.
“How do I crop a Photo in Illustrator?” is the All-Time hottest topic in the Adobe Illustrator Forum, there’s a long thread with answers that go from “not possible”, to “use Photoshop”, to “use clipping masks”, to “use Artboards”. The thread also has the real answer to the question, cropping raster images in Illustrator is possible using a “cutter” path with a blending mode other than Normal, then Flattening Transparency. Great answer!! now this script tackles on the same principle as Flattening Transparency, it rasterizes the image within the bounds of the “cutter” path and discards what’s outside of the path bounds.
to use the script to Crop this image
draw a rectangle on top of the image to use as “cutter” path
select both, the image and the “cutter” path
run the imageCrop script
that’s all, the image gets cropped, embedded, unwanted pixels get discarded. If you don’t want your images to get destroyed, please use the other Masking methods.
Press Shift Key before running the script to Rasterize using TypeOptimized option otherwise the script will use default ArtOptimized
Press Alt Key before running the script to Rasterize using custom Resolution, otherwise the script will use an average of the base image resolution.