4 Replies Latest reply on Dec 13, 2009 5:45 PM by Ken Krugh

    Image resolution for Photoshop EPS bitmaps

    Ken Krugh

      Greeting all,

       

      I've posted about getting image resolution before and have a script we've been using with great success but I just learned from my operator that the script never returns the resolution for Photoshop EPS bitmap files.

       

      I'm using .Graphics(1)..ActualPpi(0) and most times works just fine except for the Photoshop EPS bitmap files. Photoship color EPS, gray EPS and a bitmap TIF saved from Photoshop works just fine. Everything except Photoshop EPS bitmap.

       

      I've tried using .EPSs(1).ActualPpi but that yields the same result.

       

      Is there somethnig I'm missing (again)?

       

      Many thanks,

      Ken

        • 1. Re: Image resolution for Photoshop EPS bitmaps
          [Jongware] Most Valuable Participant

          An EPS may have originated in Photoshop, but InDesign does not know that -- and doesn't care, either. Since EPSes are generally vector files (with, oh, perhaps a few bitmaps in there, each one with its own resolution), InDesign just doesn't bother. It cannot see there is only one image in there.

           

          If you really, really need to know: of course this information is somewhere inside the image. The image size in points is in the line

           

          %%BoundingBox: 0 0 287 266

           

          -- 6th line, in the test file I made; "287" is the width in whole points, "266" is the height.

          The image width and height in pixels are somewhere lower:

           

          %ImageData: 479 444 8 3 1 479 7 "beginimage"

           

          -- where the first two items 479 and 444 are the width and height, respectively.

           

          I can imagine a javascript that first checks if it is a Photoshop EPS (line #2 usually holds the "Creator"), then scans the file for (a) the physical dimensions in points, (b) scans the file for the actual dimensions in pixels, then (c) multiplies (b) by 72.0 to get points-to-inches and divides this by (a) to get (d) the horizontal and vertical resolution.

           

          Also note that such files will open using "Edit Original" with ... Illustrator! Perhaps CS5 will recognize Photoshop-only EPSes. If you want to make sure it does, post here: https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

          • 2. Re: Image resolution for Photoshop EPS bitmaps
            Dirk Becker  Level 4

            There are special EPS conventions for raster graphics.

            In an EPS parser that I wrote back in 2002, I still have a comment / partial quote:

             

            ps6ffspecsv2.pdf:

             

            Photoshop includes a comment in the EPS files it writes so that it

            is able to read them back in again.

            Third party programs that write pixel–based EPS files may want to

            include this comment in their EPS files, so Photoshop can read their

            files. The comment must follow immediately after the %% comment block

            at the start of the file. The comment is:

            %ImageData: <columns> <rows> <depth> <mode> <pad channels>

            <block size> <binary/hex> "<data start>"

            If InDesign does not know that then some engineers better pick up a phone and talk to each other. I'd just assume though this bitmap is a special case that has slipped through testing.
            Dirk

            • 3. Re: Image resolution for Photoshop EPS bitmaps
              Kasyan Servetsky Level 5

              Hi guys,

               

              I offer the following approach to solve the problem:

               

              var myDoc = app.activeDocument;
              var myAllGraphics = myDoc.allGraphics;
              var myGraphic = myAllGraphics[0];
              var myLink = myGraphic.itemLink;
              var myLinkXmp = myLink.linkXmp;
              var myCreator = myLink.linkXmp.creator;

               

              if (myCreator.indexOf("Adobe Illustrator") != -1) {
                  alert("The first link was created in Illustrator");
              }
              else if (myCreator.indexOf("Adobe Photoshop") != -1) {
                  try {
                      var myXres = myGraphic.actualPpi[0];
                      var myYres = myGraphic.actualPpi[1];
                  }
                  catch(err) {
                      if (err == "Error: A value is not available for this type of image.") {
                          var myXres = myLinkXmp.getProperty("http://ns.adobe.com/tiff/1.0/", "tiff:XResolution");
                          var myYres = myLinkXmp.getProperty("http://ns.adobe.com/tiff/1.0/", "tiff:YResolution");
                      }
                  }
                  alert("Resolution of the first link:\nX: " + eval(myXres) + " ppi\nY: " + eval(myYres) + " ppi");
              }

               

               

              Kasyan

              • 4. Re: Image resolution for Photoshop EPS bitmaps
                Ken Krugh Level 1

                All these suggestions make sense and myself have written a routine in another scripting language that got the resolution of the Photoshop EPS image files.

                 

                Jongware's suggestion also makes perfect sense except that Photoshop grayscale AND color EPS files work just fine as I mention in the original post. That, to me, is the strangest part of it.

                 

                Ken