How do I get rid of this invisible box?
When I use the "direct selection tool" (not the regular selection tool) to select the image, this box randomly shows up around it... It is making the script I wrote freak out. Basically, what I need to do is resize the image to a specific dimension by inches (constrained as well), but this random box around it is not helping....
For some images, I can ungroup and group again, then run my script and it will work, but overall I need something that will work for every file. I need to be able to write this in a script, so please let me know how to do this manually... without creating a whole new file. I left the "layers" box open, so you can see how the image is (terribly) organized. The problem is EVERY image is going to be different...so I need to figure out a way to just nuke that box. I've tried deleting certain objects, I just don't understand what it is.
Your dancer image seems to be a JPG imported in Illustrator. Since you seem to want to use a script in Illustrator but work on raster with this software (by the way, Photoshop is easier for this), here's what you can do:
Why not simply crop it in Photoshop and place it again in Illustrator. This way you will still have that box but it will be the size of your artboard or at least smaller.
Additionally, you can also make that background transparent in Photoshop using a layer mask, applying it and then importing again that image in Illustrator. Don't import as a JPG though, there's no transparency with that file format.
You will always have that bounding box when you import a JPG or any raster in Illustrator, and even with a clipping mask it will be there (plus the clipping mask box). So maybe it's easier to simply get rid of the extra white parts of your JPG.