Getting canvas size vs pixel size

I am attempting to get the bounds of smart object layers where the layer is 100x100 pixels, but ehen I get the layer bounds it only returns the sixe of the area within the canvas that has pixel data (62x62). Is it possible to get the canvas size from each layer rather than the bounds whic seems to return only thepixel data size?

you can use batchPlay and play “get” action… it should be “smartObjectMore” property of the “layer” …somewhere in that object.

1 Like

Every time I attempt to write a batchPlay for this I get the error:

The command “< unknown >” is not currently available.

Would you possibly be able to provide me with a snippet that uses the “get” action to access the “smartObjectMore” property?

Here is my snippet:

let command = [{ _obj: 'get' }];
const result = await action.batchPlay(
	command,
	{ synchronousExecution: true }
)[0];
console.log(`Result: ${JSON.stringify(result)}`);
const {batchPlay} = require("photoshop").action;

const result = await batchPlay(
   [
      {
         _obj: "get",
         _target: [
            {
               _property: "smartObjectMore"
            },
            {
               _ref: "layer",
               _id: 1231
            },
            {
               _ref: "document",
               _id: 137
            }
         ],
         _options: {
            dialogOptions: "dontDisplay"
         }
      }
   ],
   {}
);

const pinned = result[0].smartObjectMore.size;

Alchemist plugin can generate code snippets for you

Thank you! This is exactly what I needed!