I agree it cannot be scripted to automatically adjust bounding boxes. A script doesn't have access to the 'contents' of a placed image, thus it cannot check if it's just whitespace that got cropped, or an incredibly important atom just got deleted.
A script can be aware of an image being cropped, but (fortunately!) you thought of mentioning that might also be valid. So you are correct: only all cropped images can be flagged, and it's up to the operator to decide whether it's wrong or not.
Hold on while I do some testing. (Insert telephone waiting muzak here.)
…
(di da di da … got something … almost done …)
Okay — finding suspicious items is not the problem. How they should be marked, however, is. This javascript creates a bright red “Warning” color and a “Warning” object style with a thick fat red line, and applies it to the frame. So — do not use this if you are already using another object style on your images! (In that case I'd like to hear from you what other options there are to mark items…)
try { app.activeDocument.objectStyles.add({name:”warning”}); } catch(_) {}
try { app.activeDocument.colors.add ({space:ColorSpace.RGB, colorValue:[255,0,0], name:”Warning”}); } catch (_) {}
warningStyle = app.activeDocument.objectStyles.item(“warning”);
warningStyle.properties = { enableStroke:true, enableFill:false, strokeColor:app.activeDocument.swatches.item(“Warning”), strokeWeight:5, strokeAlignment:StrokeAlignment.INSIDE_ALIGNMENT};
imageList = app.activeDocument.allGraphics;
found = 0;
for (im=0; im<imageList.length; im++)
{
try { if (isImageCropped (imageList[im].geometricBounds, imageList[im].parent.geometricBounds))
{ found++; imageList[im].parent.appliedObjectStyle = warningStyle; } } catch (_) { found++; imageList[im].parent.appliedObjectStyle = warningStyle; }
}
alert (“Found “+(found?found:”no”)+” suspicious frame”+(found==1?””:”s”));
function isImageCropped (img, frame) {
if (img[0] < frame[0] || img[1] < frame[1] || img[2] > frame[2] || img[3] > frame[3]) return true; return false; }