So I am trying to write a Google script that will create an image file from 3 different image files that are on google drive. The method that I have decided to use was to create a template or a base gDraw file in Drive and then modify the file and export it as a jpeg. So far I've been able to export my gDraw file as image using the code from this post 1)Is there a Google Appscript command that can convert a .gDraw to a .jpg? 2)Can a trigger be set to perform this conversion on .gdraw file edit? .
function gDrawTO_jpeg(){
var gDrawFile = Drive.Files.get('1P2qYTyeI9RovsI_qwiMEtlBeTJw-exjckQeYLL_NA7w');
var url = gDrawFile.exportLinks['image/jpeg'];
var token = ScriptApp.getOAuthToken();
var response = UrlFetchApp.fetch(url, {
headers: {
'Authorization': 'Bearer ' + token
}
});
var jpeg = response.getBlob();
// save drawing as jpeg file to Drive, or do whatever you need to with the blob
DriveApp.createFile(jpeg);
}
What I'm stuck on is trying to figure out how to replace the images in the gDraw file.
Thanks in advance for any help!