0

I am writing a script for Google Slides using Apps Script (including Slides API) for auto-formatting presentations. Crucial function there is to recolor images using certain color.

function img() {
var i_id = SlidesApp.getActivePresentation().getSlides()[0].getImages() [0].getObjectId();
Logger.log(i_id);
var p_id = SlidesApp.getActivePresentation().getId();
var requests = [{ 
updateImageProperties:{
  objectId: i_id,
  imageProperties: {
    recolor: {
      recolorStops: [{
        color: {
          rgbColor: {
           red: 0.4,
            green: 0.9,
            blue: 0.4
          }

        },
         alpha: 1,
        position: 0.5
      }]

    }
  },  
  fields: "recolor.recolorStops(color.rgbColor(red,green,blue),alpha,position)"    
}
}];
Slides.Presentations.batchUpdate({'requests': requests}, p_id)}

I have written the code and it doesn't trigger error, however image is left unchanged.

After batchupdate request, the image should have been recolored. Is there a problem within the code? If anybody can provide any help, I would be so grateful!

Igor
  • 13
  • 4
  • When the document of ``Recolor`` of ``ImageProperties`` for UpdateImagePropertiesRequest is checked, it says ``This property is read-only.``. https://developers.google.com/slides/reference/rest/v1/presentations.pages/other#recolor By this, I think that the image color cannot be changed by ``Recolor``. – Tanaike Apr 04 '19 at 23:14
  • Hi Tanaike, thank you very much for reply! Indeed, I was afraid of this... thank you for clarification! – Igor Apr 08 '19 at 18:59
  • Thank you for replying. But I apologize that the issue was not resolved by the specification. – Tanaike Apr 08 '19 at 22:06

0 Answers0