I tried to extract the Color Space (RGB/CMYK) & Effective Resolution of the images placed in InDesign. With the help of the dictionary, I come out with the following but it doesn’t work at all:-
tell application "Adobe InDesign CS2"
activate
tell document 1
set theLink to every link
repeat with l from 1 to count of theLink
set theColorSpace to color space of link l
set theEffectiveRes to effective ppi of link l
end repeat
end tell
end tell
I couldn’t figure out where are the mistakes, please advise!
Thanks in advance.
tell application "Adobe InDesign CS3"
set theColorSpace to space of parent of link 2 of document 1
set theEffectiveRes to effective ppi of parent of link 2 of document 1
end tell
Be warned though that vector images like PDFs do not have a value for either of these properties so you will have to test for the type of object and only get it for pixel images. You could check the class before getting the space and ppi, for a pixel image you will get “image” and pdf will be “pdf”, eps files should give you “PostScript picture”.
effective ppi and space are properties of image, not of link
this script writes all requested information into two lists
tell application "Adobe InDesign CS2"
activate
tell document 1
set theLink to every link
set {theColorSpace, theEffectiveRes} to {{}, {}}
repeat with l from 1 to count of theLink
set end of theColorSpace to space of parent of link l
set end of theEffectiveRes to effective ppi of parent of link l
end repeat
end tell
end tell
Works fine in CS4 here. Could be because your first link was a vector eps or PDF. Here’s my modified version of StefanK script, it shouldn’t try to get info out of a vector eps but it’s only a draft
Didn’t do anything to filter out PDFs though…
tell application “Adobe InDesign CS4”
activate
tell document 1
set theLink to every link
set {thename, theColorSpace, theEffectiveRes} to {{}, {}, {}}
repeat with l from 1 to count of theLink
set pic_properties to get properties of parent of link l
if pic_properties does not contain {CMYK vector policy:ignore all} and pic_properties does not contain {RGB vector policy:ignore all} and pic_properties does not contain {gray vector policy:ignore all} then
set end of thename to name of link l
set end of theColorSpace to space of parent of link l
set end of theEffectiveRes to effective ppi of parent of link l
end if
end repeat
end tell
end tell
log thename
log theColorSpace
log theEffectiveRes
You are right, it doesn’t work because of eps format. However, the strange thing is ID CS4 doesn’t work with raster eps which was saved by PhotoShop too (which used to work fine in ID CS3).
Good advice and now I have a better idea about the problem. However, I am now being confused by the way ID handles raster eps files. By adapting your method of calling out its properties, I found that some parameters missing such as actual ppi and effective ppi from the raster eps placed. I use PhotoShop to re-save the eps then everything works fine.
But why it happens this way?
(P.S. Sorry that I have provided a wrong info previously saying that it does work fine in CS3 but not CS4 which is my mistake because I am not using the same links)
I am using CS4 and tested the properties of link x’s parent. This will provide me actual ppi values for other file formats, e.g., TIFF, GIF, JPEG, but not a Photoshop rasterized EPS. Is this a limitation I will just have to deal with? It’s not a big deal if that’s the case, just wondering?