Copy link to clipboard
Copied
i want to export pixel dimensions and color space data from a few thousand images to text files. i discovered that the information can be exported as a metadata template from file info (camera data 2), but i have been unable to record the necessary action for the purpose of doing this in a batch process. when i try to record the action, nothing is recorded other than opening and closing the file.
no one has any ideas as to how to make photoshop record the action, but someone suggested that a script might be able to do it. any ideas?
any way to do this would be fine. i'm not wedded to the metadata template, although i would be able to process those files easily enough.
i should tell you i've written maybe 4 or 5 successful applescripts in my life, almost all of them for the finder, so please be very explicit.
thanks
Copy link to clipboard
Copied
So this is real is. I'm going to give you the code, then record an action to play this javascript file that you copy and past the code into.
you can then run a batch, and
var imageHeight = activeDocument.height
var imageWidth = activeDocument.width
var imageName = activeDocument.name.toString()
var imageDementions = new File ("~/desktop/dementions.txt")
imageDementions.open('a');
imageDementions.write(imageName + ", " + imageHeight + ", " + imageWidth + "\n");
activeDocument.close(SaveOptions.DONOTSAVECHANGES)
imageDementions.close();
that should get you through it. I have functions built to search for files in a folder, then run whatever you want to those files, but just running this script in a batch is much easier.
Copy link to clipboard
Copied
this actually looks kind of promising.
i copied your code into a file i called metadata1.js, and recorded an action that does nothing but open a file and run the script.
i think it worked because the files all closed shortly after they opened. the script must have dine that because it wasn't part of the action.
anyway, i expected the script to create a file on my desktop called dementions.txt.
that didn't happen.
i then created the file myself and ran a batch with the action, hoping the file would have some data in it after the batch completed, but no.
so obviously i'm missing something.
sorry to be such a dolt.
also, can i get a variable for color space?
Copy link to clipboard
Copied
You've several options available to you… As you have mentioned AppleScript I will start there…
AppleScript has a faceless app called Image Events you can use this to extract the properties you want…
This app just gives you easier access to SIPS you can do shellscript and do this yourself…
Apple has spotlight that will store metadata about your files again you can do shell script with MDLS…
You could AppleScript PhotoShop to open the files but this is a massive waste ( no need to open them ).
Using extendScript again you could use PhotoShop but the same waste wrong tool for the job.
A Bridge script would be better and faster me thinks…
Using shell is super quick… but you need to search else where to get what you need… ( I've pretty much forgotten the bits I knew oops )