7 Replies Latest reply on Mar 15, 2013 8:15 PM by Muppet Mark

    Finding image properties?

    JonnyDL Level 1

      I'm looking for a way in applescript to get the properties of an image in a rectangle specifically its color space. I want to be able to place info about the image in a text box.

      I can get the the images

      set theimages to all graphics of page 1

       

      but I can't get find the code that digs deeper into the individual images/graphic

      Can anybody help?

        • 1. Re: Finding image properties?
          Muppet Mark Level 5

          There are numerous ways to skin this cat using AppleScript… Here is an example that should show you what File/Image Data is available to MDLS & SIPS… You can use AppleScript's Image Events but it's pretty much SIPS in AppleScript classes… Both of these utilities will allow you to pull particular keys if you want or you can get the whole blob and parse in AppleScript… I guess you can sort the rest…

           

          tell application "Adobe InDesign CS5"

                    tell the active document

                              set myGraphics to all graphics

                              repeat with thisGraphic in myGraphics

                                        set imgType to image type name of thisGraphic

                                        if imgType = "JPEG" then

                                                  set myFile to file path of item link of thisGraphic

            -- Convert HFS path to POSIX for the shell

                                                  set myFile to quoted form of POSIX path of myFile

            -- Use Spotlight metadata

                                                  set mdlsData to my mdlsImage(myFile)

            display dialog (mdlsData) giving up after 3

            -- Use Scriptable Image Processing System

                                                  set sipsData to my sipsImage(myFile)

            display dialog (sipsData) giving up after 3

                                        end if

                              end repeat

                    end tell

          end tell

           

          on mdlsImage(path)

                    return (do shell script "mdls " & path)

          end mdlsImage

           

          on sipsImage(path)

                    return (do shell script "sips −-getProperty -g all " & path)

          end sipsImage

          • 2. Re: Finding image properties?
            JonnyDL Level 1

            Thanks! This stuff I would of never found (or thought of). Though  its not giving me the info I thought it would.

             

            I changed the imagetype to "Adobe PDF" because those are the types I'm after. When run Im getting RGB profiles (space) on all the PDFs. The PDFs are either CMYK or grayscale.

            I was hoping to get a CMYK space.

             

            Its got to be the PDFs and how they are processed. They go through a process that changes the colors to CMYK. Acrobat output previews as CYMK? So I'm unsure how to distinguish CYMK PDF from a grayscale one?

             

            Again Thanks, The code supplied is appreciated, and will give me more code to learn and play with

            • 3. Re: Finding image properties?
              Muppet Mark Level 5

              Your subject stated find *image* proprties… mdls is fairly generic file metadata… sips is for image data… PDFs can be a mixed bag of all sorts but in general a grayscale PDF is a cmyk PDF containing only data in the k plate is it not…?

               

              Edit. Do you know what app created the *.pdf files…? If so I may be able to help with a different route…

              • 4. Re: Finding image properties?
                JonnyDL Level 1

                I thought the image properties was the way to go, it would have the data I need, guess not. I figured the PDF was considered an image, and I didn't even think of how much stuff can be compacted into a PDF.

                 

                Yes a grayscale PDF is a cmyk PDF containing only data in the k plate is it not. So I need to find a way to get the CMYK values to use and compare..Internet search engine, here I come....This should be fun ;]

                • 5. Re: Finding image properties?
                  Muppet Mark Level 5

                  *.pdf, *.ai ( with PDF compatability to place in ID ) & *.eps files can contain all sorts of data… It is possible in some cases to find what plates they make… Do you know what created these files or are they mixed bag from every where…?

                  • 6. Re: Finding image properties?
                    JonnyDL Level 1

                    Their creation is a mix bag, but the all get processes through a central process (onevision Asura/distiller) which converts all the pdfs into to CMYK or grayscale (as well as a lot of other settings I'm not aware of). So I would hope that they then would contain consistant color info we could pull from them.

                    • 7. Re: Finding image properties?
                      Muppet Mark Level 5

                      I know what strings to look for inside of *.pdf & *.eps files created by Adobe apps AI & ID… These are pretty much the only file creators I use regular. What I have not looked at is if these are file format standards that all creators adhere to… ( these documents I just don't have the hours to read up on )… Basically you may just need to read & grep the file this can be done calling JavaScript or shell…