2 Replies Latest reply on Feb 20, 2015 9:40 AM by Tom Ruark

    Check image size before opening into photoshop

    Beracah SB Level 1

      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.

        • 1. Re: Check image size before opening into photoshop
          matias.kiviniemi Level 3

          File size you can get from File.lenght:


          var f = new File(path)

          var l = 0

          if (f.exists) l = f.lenght


          f = null

          Dimensions is probably hard

          • 2. Re: Check image size before opening into photoshop
            Tom Ruark Adobe Employee

            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.