使用Google Slides API为图像重新着色

时间:2019-04-04 19:50:40

标签: google-slides-api

我正在使用Apps脚本(包括Slides API)为Google幻灯片编写脚本,以自动格式化演示文稿。至关重要的功能是使用某些颜色为图像重新着色。

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)}

我已经编写了代码,它不会触发错误,但是图像保持不变。

在批处理更新请求之后,图像应该已经重新着色。代码内有问题吗?如果有人可以提供任何帮助,我将非常感激!

0 个答案:

没有答案
相关问题