Copy link to clipboard
Copied
Hi Guys,
Is there any way to check image size before opening an image into photoshop.
Example: I need a notification if the file size is above 100MB and stop opening, else no notification is required just open as is.
all suggestions invited.
Copy link to clipboard
Copied
File size you can get from File.lenght:
var f = new File(path)
var l = 0
if (f.exists) l = f.lenght
f.close()
f = null
Dimensions is probably hard
Copy link to clipboard
Copied
The length (not lenght) would be a good check for "how long might this take?" as described above (using length).
The PSD has the width and height in the first few bytes of the format. You would have to research all formats you care about to find how hard it is to figure out the width and height. And for PSD files you probably want to find out how many layers it has and the dimensions of the layers (a layer could be MUCH larger than the file width and height) so your task is difficult.
And there is no way from a script to cancel the open if and when it is taking too long. You would need a separate application monitoring Photoshop for the progress bar to show up and then simulating a "cancel". That would not be easy either.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now