• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

how to get the placed layer details

Participant ,
Aug 08, 2024 Aug 08, 2024

Copy link to clipboard

Copied

i have psd file in that one of the layer i have attached placed which is .png file
how to get those details

Screenshot 2024-08-08 at 4.59.13 PM.png

 here in the above screenshot first layer contains the placed layer , when i double click one png file will open.
so how get that png file details, like width,height,name and image data.
and that placed layer details where they will save meaning in which block they will save the placed layer data.
thank you

TOPICS
Actions and scripting

Views

350

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
Adobe
Community Expert ,
Aug 08, 2024 Aug 08, 2024

Copy link to clipboard

Copied

Votes

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 ,
Aug 08, 2024 Aug 08, 2024

Copy link to clipboard

Copied

@Mahesh12 

 

To edit/open a Photoshop-compatible raster Smart Object layer/file (assumed as placed or embedded):

 

if (app.activeDocument.activeLayer.kind == LayerKind.SMARTOBJECT) {
    app.runMenuItem(stringIDToTypeID('placedLayerEditContents'));
}

 

You can then use the document class properties:

 

https://theiviaxx.github.io/photoshop-docs/Photoshop/Document.html

 

alert("Doc width: " + app.activeDocument.width);

// or

alert("Doc width: " + app.activeDocument.width.value);

// or

var savedRuler = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
alert("Doc height: " + app.activeDocument.height.value);
app.preferences.rulerUnits = savedRuler;

// or

alert("Doc height: " + app.activeDocument.height.as('px'));

 

I believe that the code from @c.pfaffenbichler directly retrieved the properties of the SO without opening it.

Votes

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 ,
Aug 08, 2024 Aug 08, 2024

Copy link to clipboard

Copied

Votes

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 ,
Aug 08, 2024 Aug 08, 2024

Copy link to clipboard

Copied

»here in the above screenshot first layer contains the placed layer , when i double click one png file will open.
so how get that png file details, like width,height,name and image data.«

What do you mean by »image data«? 

 

 

// based on code by michael l hale;
// 2024, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var layerDesc = executeActionGet(ref);
var soDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObject'));
var soMoreDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObjectMore'));
checkDesc2 (soMoreDesc.getObjectValue(stringIDToTypeID("size")));
};
////// based on code by michael l hale //////
function checkDesc2 (theDesc) {
var c = theDesc.count;
var str = '';
for(var i=0;i<c;i++){ //enumerate descriptor's keys
	str = str + 'Key '+i+' = '+typeIDToStringID(theDesc.getKey(i))+': '+theDesc.getType(theDesc.getKey(i))+'\n'+getValues (theDesc, i)+'\n';
	};
alert("desc\n\n"+str);
};
////// check //////
function getValues (theDesc, theNumber) {
switch (theDesc.getType(theDesc.getKey(theNumber))) {
case DescValueType.ALIASTYPE:
return theDesc.getPath(theDesc.getKey(theNumber));
break;
case DescValueType.BOOLEANTYPE:
return theDesc.getBoolean(theDesc.getKey(theNumber));
break;
case DescValueType.CLASSTYPE:
return theDesc.getClass(theDesc.getKey(theNumber));
break;
case DescValueType.DOUBLETYPE:
return theDesc.getDouble(theDesc.getKey(theNumber));
break;
case DescValueType.ENUMERATEDTYPE:
return (typeIDToStringID(theDesc.getEnumerationValue(theDesc.getKey(theNumber)))+"_"+typeIDToStringID(theDesc.getEnumerationType(theDesc.getKey(theNumber))));
break;
case DescValueType.INTEGERTYPE:
return theDesc.getInteger(theDesc.getKey(theNumber));
break;
case DescValueType.LISTTYPE:
return theDesc.getList(theDesc.getKey(theNumber));
break;
case DescValueType.OBJECTTYPE:
return (theDesc.getObjectValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getObjectType(theDesc.getKey(theNumber))));
break;
case DescValueType.REFERENCETYPE:
return theDesc.getReference(theDesc.getKey(theNumber));
break;
case DescValueType.STRINGTYPE:
return theDesc.getString(theDesc.getKey(theNumber));
break;
case DescValueType.UNITDOUBLE:
return (theDesc.getUnitDoubleValue(theDesc.getKey(theNumber))+"_"+typeIDToStringID(theDesc.getUnitDoubleType(theDesc.getKey(theNumber))));
break;
default: 
break;
};
};

Screenshot 2024-08-09 at 08.24.22.png

 

Votes

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
Participant ,
Aug 09, 2024 Aug 09, 2024

Copy link to clipboard

Copied

thanks @c.pfaffenbichler  

Votes

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 ,
Aug 09, 2024 Aug 09, 2024

Copy link to clipboard

Copied

As for the name: 

// based on code by michael l hale;
// 2024, use it at your own risk;
#target photoshop
if (app.documents.length > 0) {
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") ); 
var layerDesc = executeActionGet(ref);
var soDesc = layerDesc.getObjectValue(stringIDToTypeID('smartObject'));
alert (soDesc.getString(stringIDToTypeID('fileReference')));
};

Votes

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
Participant ,
Aug 09, 2024 Aug 09, 2024

Copy link to clipboard

Copied

@c.pfaffenbichler  thanks i'll  check this.

Screenshot 2024-08-10 at 9.01.37 AM.png

in the above screenshot  the placed layer details where it is saved.

Screenshot 2024-08-10 at 9.03.27 AM.png


for example in th second screenshot i have provided .  when i double click one jpeg file will open.and that jpeg file contains path.

Screenshot 2024-08-10 at 9.06.08 AM.png

the  third image is the path that jpeg file contains.
how to retrieve this path point and in the photoshop file format structure where that placed layer path point details are stored.

 

Votes

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 ,
Aug 10, 2024 Aug 10, 2024

Copy link to clipboard

Copied

I doubt that this is possible with ESTK Scripting without opening the Smart Object. 

Votes

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
Participant ,
Aug 10, 2024 Aug 10, 2024

Copy link to clipboard

Copied

hi @c.pfaffenbichler  in photoshop file format in which section that placed layer data is saved.

Votes

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 ,
Aug 10, 2024 Aug 10, 2024

Copy link to clipboard

Copied

No idea. 

If you want to read the file data itself make sure the file is actually saved while »plain« ESTK Scripting will reflect the changes in open but unsaved images. 

Votes

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 ,
Aug 10, 2024 Aug 10, 2024

Copy link to clipboard

Copied

@Mahesh12 

 

Your “Photoshop file structure" screenshot would appear to be something related to SDK or perhaps another non-scripting resource. I previously linked to one source of documentation on scripting DOM for an open document.

Votes

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
Participant ,
Aug 10, 2024 Aug 10, 2024

Copy link to clipboard

Copied

@Stephen_A_Marsh  yes i just want know about that where exactly the placed layer path point details are saved according to that file structure

Votes

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 ,
Aug 10, 2024 Aug 10, 2024

Copy link to clipboard

Copied

Votes

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
Participant ,
Aug 12, 2024 Aug 12, 2024

Copy link to clipboard

Copied

LATEST

Votes

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