Copy link to clipboard
Copied
Hi all,
I'm looking for a variation of this script:
That instead of JPEGs being given a unique name on export, they get their filenames from the placed image in the object. Essentially I'll be using InDesign to recrop hundreds of images.
I'm sure you're wondering 'why just not use Photoshop/Lightroom?' and the answer is I need to be able to crop images relative to how they look alongside other images and then commit that crop somehow whilst retaining the filename (so as to avoid retyping it each time).
Can anyone think of a way to pass the linked filename through the script and assign it to the out put image?
Thank you in advance,
Copy link to clipboard
Copied
Assuming the selections are done with a black arrow tool, then change this snippet
_pageItems[i].id
to
_pageItems[i].graphics[0].itemLink.name.replace(/\.[a-z]+$/gi,"")
The replace code at the end should strip the extension of the linked item's filename, since you're replacing it with jpg.
Copy link to clipboard
Copied
Thanks @brianp311, this is a huge step forward and really exciting. You've solved the filename passthrough for me so thank you very much.
But as @Laubender highlights there are a few things I hadn't anticipated that I will need to factor in to get my final solution. I'll reply to that comment for future readers of this thread.
Copy link to clipboard
Copied
FWIW: Still I would implement a unique number with the exported file name in case one image is placed more than one time. I'm not sure, if the placed image should be exported or the frame holding the image. It sounds, that the frame should be exported. And what if the frame is part of a group? Should the group be exported?
What about color mode and the amount of pixel density?
With an export to JPEG from InDesign you are going to do a "One Size Fits All" approach.
Or do you see into effective resolution and calculate the individual export according to that?
Also if a certain color profile is in the placed image. Would you maintain it?
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
You're quite right, @brianp311 's solution is exactly what I asked for but your comment highlights a few things I should also have thought about.
"FWIW: Still I would implement a unique number with the exported file name in case one image is placed more than one time." - I think it's safe to say this isn't required but sensible to have. However, it must be consistent not random.
"I'm not sure, if the placed image should be exported or the frame holding the image. It sounds, that the frame should be exported." - correct, the frame dictates the new crop for the placed image. @brianp311 's solution works exactly how I'd hoped.
"And what if the frame is part of a group? Should the group be exported?" Good question but not required at all and thankfully avoids the conundrum of which of the group's contents the filename should be derieved. Phew.
"What about color mode and the amount of pixel density?
With an export to JPEG from InDesign you are going to do a "One Size Fits All" approach.
Or do you see into effective resolution and calculate the individual export according to that?"
- I realised after running the new script that I was getting images varied with varied dimensions, so you're quite right. What I need is for the resulting image to always be 3000px tall and width auto so that the ratio is maintained. Resolution 72dpi and colour space to be sRGB.
Thank you,