


So although I had thought of other workaround, I had not been able to find it. But in this method, the resized blob cannot be retrieved. As a workaround, there is a method that it imports the image in Google Document and resizes the image using setWidth() and setHeight(). Unfortunately, there are no methods to resize images at Google Apps Script. This method ( getSize()) can retrieve the size information from BMP, GIF, PNG and JPG files. This sample image is created by k3-studio.

From this demo, you can see the speed for retrieving the size information from files. the size information is retrieved from BMP, GIF, PNG and JPG files. By this, the low process cost could be achieved.

So I thought of retrieving the information of image at the binary level, and created this. But in this method, it uses much time and resources on Google. As a workaround, there is a method that it imports the image in Google Document and retrieves the size using getWidth() and getHeight(). Unfortunately, there are no methods to directly retrieve the image size at Google Apps Script. This method is for retrieving the width and height of image as the unit of pixel. By the authorization for Google Services, Drive API is enabled automatically.** Users are not necessary to enable Drive API on Google API console. Recently, I confirmed that users can use Drive API by only the authorization for Google Services. ** * The method of doResize() uses Drive API. If you want to read about Libraries, please check this.
