4 Replies Latest reply on Mar 16, 2016 8:43 AM by pauls983716

    Placing images while preserving swatch effects

    pauls983716

      Hi There,

       

      I'm working on a script to pre populate artwork from an internal database, I am placing images using the following style at present.

       

      imgFrameGCL[index] = addFrame(101, 230, 25, 6, '123');
      imgFrameGCL[index].place(File("/Projects/IDD Templates/icons/gcl.ai"), false);
      imgFrameGCL[index].name = "imgFrameGCL["+index+"]";
      imgFrameGCL[index].fit(FitOptions.proportionally);
      imgFrameGCL[index].fit(FitOptions.centerContent);
      

       

      This places the image just fine, the only problem is that these images that I am importing are plain black vectors that can change from artwork to artwork, how the designers currently manage this process is by pasting the plain black vector in from illustrator and then changing the color by swapping the swatch.

       

      With the above code opening the images a) as links, b) inside a text frame the swatch option is not available.

       

      could anyone advise how i could embed these images and have swatches applied to them?

       

      Thanks

        • 1. Re: Placing images while preserving swatch effects
          Vamitul Level 4

          you are overthinking stuff..

          
          
          imgFrameGCL[index] = addFrame(101, 230, 25, 6, '123');  
          var img=imgFrameGCL[index].place(File("/Projects/IDD Templates/icons/gcl.ai"), false);
          img.fillColor=thatSwatch;
          imgFrameGCL[index].name = "imgFrameGCL["+index+"]";  
          imgFrameGCL[index].fit(FitOptions.proportionally);  
          imgFrameGCL[index].fit(FitOptions.centerContent);  
          
          
          
          
          • 2. Re: Placing images while preserving swatch effects
            pauls983716 Level 1

            Thanks for the reply, That was the first thing I tried, however that only seems to effect the text frame itself and isn't changing the color of the image within.

             

            infact the following line wasn't have any change at present strangely.

             

            img.fillColor = myDocument.swatches.item("test");
            
            • 3. Re: Placing images while preserving swatch effects
              Laubender Adobe Community Professional & MVP

              Hi Paul,

              you cannot color placed ai graphics in InDesign. That's not a feature with InDesign.

              You can only color gray scale or 1bit pixel images without transparency.

              ( And that includes PhotoShop pixel images in gray scale stored with a Background layer only! The one where the name is in italics in the Layers Panel of PhotoShop. )

               

              To work around this problem with vector paths, you could cross-scripting InDesign with Adobe Illustrator to copy/paste vector paths. Just like the designer is doing right now.

              But that's no safe bet either. A lot of things can go wrong by pasting Illustrator paths to InDesign. Missing paths. Too complex paths. Changes in stroke alignment. Etc.pp.

               

              Best would be to script Adobe Illustrator to open a placed ai graphic, do the color work in Illustrator by scripting, save a new ai file and replace the old one placed in InDesign.

              If it is possible to script Illustrator to the extend you want to, I cannot tell.

               

              Uwe

              • 4. Re: Placing images while preserving swatch effects
                pauls983716 Level 1

                Thanks for the reply,

                 

                I wasn't aware cross-scripting was an option, I will look into that one.

                 

                Thanks