Linked image color space

Explorer ,
Mar 15, 2018 Mar 15, 2018

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..

main-qimg-3203ac6a4943a4839593e4e83a0b6c54.png

Murali.M
TOPICS
Scripting

Views

688

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Mar 16, 2018 Mar 16, 2018

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

...

Likes

Translate

Translate
Community Expert ,
Mar 16, 2018 Mar 16, 2018

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...

スクリーンショット 2018-03-16 17.11.41.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 16, 2018 Mar 16, 2018

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);

Murali.M

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 16, 2018 Mar 16, 2018

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);

スクリーンショット 2018-03-17 10.33.43.png

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 18, 2018 Mar 18, 2018

Copy link to clipboard

Copied

For the discussion, wouldn't XMPString property of the document return all needed infos ? Would avoid loading XMPLib ?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 18, 2018 Mar 18, 2018

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

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 29, 2022 Apr 29, 2022

Copy link to clipboard

Copied

LATEST

Dear Ten A,

You saved my day.

-Sumit

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 19, 2018 Mar 19, 2018

Copy link to clipboard

Copied

You are right. I discarded the linked image part

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines