I have a blob containing an image that is remotely loaded and created in Google Drive:
var response = UrlFetchApp.fetch(fileURL);
var fileBlob = response.get
If my understanding is correct, how about this answer? Please think of this as just one of several possible answers.
Unfortunately, in the current stage, there are no methods for resizing directly the image in Google Apps Script. But there is a workaround. The flow of this workaround is as follows.
thumbnailLink is retrieved.thumbnailLink.
thumbnailLink is like https://lh3.googleusercontent.com/###=s220.=s220 is changed, the size of thumbnail is also changed. This workaround uses this.Before you run the script, please set the variables of width, outputFilename and url. And also, please enable Drive API at Advanced Google services.
function myFunction() {
var width = 10; // Please set the size of width with the unit of pixels.
var outputFilename = "sample.png"; // Please set the output filename.
var url = "###";
var blob1 = UrlFetchApp.fetch(url).getBlob().setName("sampleImage_temporal");
var fileId = DriveApp.createFile(blob1).getId();
var link = Drive.Files.get(fileId).thumbnailLink.replace(/\=s.+/, "=s" + width);
var blob2 = UrlFetchApp.fetch(link).getBlob().setName(outputFilename);
var file = DriveApp.createFile(blob2);
Drive.Files.remove(fileId);
}
image/png.If this was not the direction you want, I apologize.