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

Check image size before opening into photoshop

Explorer ,
Feb 19, 2015 Feb 19, 2015

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.

TOPICS
Actions and scripting
391
Translate
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
Enthusiast ,
Feb 19, 2015 Feb 19, 2015

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

Translate
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
Feb 20, 2015 Feb 20, 2015
LATEST

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.

Translate
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