javascriptadobe-indesignbasil.js

Manipulating image within Indesign frame


I am currently trying to figure out how to change the color of a bitmapped image within indesign using basil.js. Ideally I would like to place the image and use some sort fo post styling to change the color.

var myImage = image('image_0009_10.psd', 0, 0, width, height);
property(myImage, "fillColor", "RISOBlue");

Right now I am using fillColor but that only changes the color of the frame that the bitmap live within. Anyone got any ideas as to how to edit the contents of a graphic frame? Specifically a bitmap?


Solution

  • fabianmoronzirfas is correct that you have to target the graphic of the image frame, I just want to suggest a slightly different syntax, which is a bit more basil-like to achieve the same thing:

    // @include ~/Documents/basiljs/basil.js
    
    function draw() {
    
      var myImage = image('~/Desktop/someImage.psd', 0, 0);
      var myGraphics = graphics(myImage);
      property(myGraphics[0], 'fillColor', color(0, 0, 255));
    
    }
    

    Note the use of the graphics() function to get the actual graphics within an image rectangle.