Resizing image in Google Apps Script

Hann picture Hann · Apr 23, 2014 · Viewed 11.2k times · Source

I have an image and I want to resize this.

App Script code:

var fileId = 'idImage';
var img = DriveApp.getFileById(fileId).getBlob().;
newFile.getBody().insertImage(0, img); 

Object Blob can't resize so how can I resize my image?

Regards

Answer

Hann picture Hann · Apr 23, 2014

I found a solution :

var fileId = 'ImageID';
var img = DriveApp.getFileById(fileId).getBlob();
var imgDoc = newFile.getBody().insertImage(0, img); 
imgDoc.setWidth(630);

It's an inlineImage object.

link : https://developers.google.com/apps-script/reference/document/inline-image