Something like this might work for images in a given active document. Note, I’m a bit rusty and don’t have access to ID currently to check. For more info on the properties you can write to the file, check: https://jongware.mit.edu/idcs6js/pc_Graphic.html
/////////////////////////
var graphicsArr = app.activeDocument.allGraphics;
var path = ‘~/Documents/’;
var filename = app.activeDocument.name.split()[0] + ‘.json’;
var file = new File(path + filename);
file.encoding = ‘UTF-8’;
file.open(‘w’);
for (var i = 0; i < graphicsArr.length; i++) {
var g = graphics.Arr[i];
if (g.itemLink.isValid) {
file.write(g.itemLink.name + “\r”);
}
//the graphic’s info
file.write(g.horizontalScale.toString() + “\r”);
file.write(g.verticalScale.toString() + “\r”);
file.write(g.geometricBounds.toString() + “\r”); //this comes in as an array of four numbers
file.write(g.rotationAngle.toString() + “\r”); //second return mark to separate different graphics
//the parent’s info (rectangle object, most likely)
file.write(g.parent.horizontalScale.toString() + “\r”);
file.write(g.parent.verticalScale.toString() + “\r”);
file.write(g.parent.geometricBounds.toString() + “\r”); //this comes in as an array of four numbers
file.write(g.parent.rotationAngle.toString() + “\r”); //second return mark to separate different graphics
}
file.close();