Copy link to clipboard
Copied
Hello guys..
Any script to ALERT linked image color space and resolution ?
Its possible without photoshop script or bridge talk ?
Thank you for your advice..
had some update previous one.
...if (ExternalObject.AdobeXMPScript == undefined) {
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}
var fNm = app.selection[0].file;
//var fNm = File.openDialog ("select target file");
var xmp = new XMPFile( fNm.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);
var obj = xmp.getXMP();
xmp.closeFile();
var result = [];
var cm = ["GrayScale","","RGB","CMYK"];
obj.serialize(XMPConst.SERIALIZE_READ_ONLY_PACKET | XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
re
Copy link to clipboard
Copied
In this case, You can retrieve some information from XMP metadata.
Here is a sample code of manipurate XMP metadata.
if (ExternalObject.AdobeXMPScript == undefined) {
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}
var fNm = app.selection[0].file;
var xmp = new XMPFile( fNm.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);
var obj = xmp.getXMP();
xmp.closeFile();
var result = [];
obj.serialize(XMPConst.SERIALIZE_READ_ONLY_PACKET | XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
result.push(obj.getProperty(XMPConst.NS_DC,"format"));
result.push(obj.getProperty(XMPConst.NS_XMP,"CreatorTool"));
result.push(obj.getProperty(XMPConst.NS_TIFF,"XResolution"));
result.push(obj.getProperty(XMPConst.NS_TIFF,"XResolution"));
result.push(obj.getProperty(XMPConst.NS_TIFF,"YResolution"));
result.push(obj.getProperty(XMPConst.NS_EXIF,"PixelXDimension"));
result.push(obj.getProperty(XMPConst.NS_EXIF,"PixelYDimension"));
result.push(obj.getProperty(XMPConst.NS_TIFF,"SamplesPerPixel"));
alert(result);
and result...
Copy link to clipboard
Copied
Thank you @ Ten A,
I need to display a alert to linked image colour space (CMYK or RGB) , and PPI.
I found a solution for color, but it's not working my system.
I don't know it's correct or not, but I just share this for your reference.
Thank you again...
if(selectList.typename== 'PlacedItem' || 'RasterItem')
var x=selectList.imageColorSpace;
alert(x);
Copy link to clipboard
Copied
had some update previous one.
if (ExternalObject.AdobeXMPScript == undefined) {
ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}
var fNm = app.selection[0].file;
//var fNm = File.openDialog ("select target file");
var xmp = new XMPFile( fNm.fsName, XMPConst.UNKNOWN, XMPConst.OPEN_FOR_READ);
var obj = xmp.getXMP();
xmp.closeFile();
var result = [];
var cm = ["GrayScale","","RGB","CMYK"];
obj.serialize(XMPConst.SERIALIZE_READ_ONLY_PACKET | XMPConst.SERIALIZE_USE_COMPACT_FORMAT);
result.push(obj.getProperty(XMPConst.NS_DC,"format"));
result.push(obj.getProperty(XMPConst.NS_XMP,"CreatorTool"));
result.push(eval(obj.getProperty(XMPConst.NS_TIFF,"XResolution").toString())+"dpi");
result.push(eval(obj.getProperty(XMPConst.NS_TIFF,"YResolution").toString())+"dpi");
result.push(obj.getProperty(XMPConst.NS_EXIF,"PixelXDimension")+"px");
result.push(obj.getProperty(XMPConst.NS_EXIF,"PixelYDimension")+"px");
result.push(Number(obj.getProperty(XMPConst.NS_EXIF,"PixelXDimension"))/app.selection[0].width*72+"(actual PPI)");
result.push(cm[Number(obj.getProperty(XMPConst.NS_PHOTOSHOP,"ColorMode"))-1]);
//result.push(""obj.getProperty(XMPConst.NS_XMP_MM,"History[1]/stEvt:when"));
alert(result);
Copy link to clipboard
Copied
For the discussion, wouldn't XMPString property of the document return all needed infos ? Would avoid loading XMPLib ?
Copy link to clipboard
Copied
To retrieve XMP image is one of an easy way to get Images info. However, some images don't have this kind of information and old Illustrator doesn't have AdobeXMPScript library. In this case, We can get information from images directly like below link.
Extend_Script_experimentals/jpgTool.jsx at master · ten-A/Extend_Script_experimentals · GitHub
Copy link to clipboard
Copied
Dear Ten A,
You saved my day.
Copy link to clipboard
Copied
You are right. I discarded the linked image part
Find more inspiration, events, and resources on the new Adobe Community
Explore Now