Screen Resolution

At the end of one of my BatchPlay functions, I resize the image to 100%. This on a 5K is a little small and 200% looks better.

Is it possible to get the users screen resolution so I can resize either to 100 or 200% depending on what they are using ?

Is this any use?

const displays = await require("photoshop").core.getDisplayConfiguration({});

displays is then an array that shows:

0:
globalBounds: {bottom: 1117, left: 0, right: 1728, top: 0}
globalWorkingBounds: {bottom: 1117, left: 0, right: 1728, top: 38}
isPrimary: true
scaleFactor: 2
[[Prototype]]: Object
1:
globalBounds: {bottom: 1080, left: -1920, right: 0, top: 0}
globalWorkingBounds: {bottom: 1080, left: -1920, right: 0, top: 25}
isPrimary: false
scaleFactor: 2
[[Prototype]]: Object

Now, that said, I don’t see an obvious way to know which of those displays is the one to pay attention to – isPrimary seems to map to my OS preference as to which is the primary display, and not the one that Ps might be running on.

Maybe @heewoo /@samgannaway have ideas about figuring out the screen size for the active document?

1 Like

If you move PS between the screens do you always get the same results

Yup – isPrimary and bounds were consistent regardless of which monitor Ps was on.

Its getting close to what I need but as you say, we don’t know which one PS is running on

@kerrishotts

Is the method getDisplayConfiguration() (including the possible parameters) documented anywhere?

I don’t see it mentioned for the Core Module here:
https://developer.adobe.com/photoshop/uxp/2022/ps_reference/media/photoshopcore/