title: Google script : how to resize image in blob?
body: <p>I have a blob containing an image that is remotely loaded and created in Google Drive:</p>
  
  <pre><code>var response = UrlFetchApp.fetch(fileURL);
  var fileBlob = response.getBlob();
  var folder = DriveApp.getFolderById('THjgj698979XXXXXXXX');
  var result = folder.createFile(fileBlob);
  </code></pre>
  
  <p>What I want is to resize the image contained in this fileBlob. How can I do that?</p>
  
  <p>For your information, a post that can help but finally didn't really help me:(explains how to resize an image, not how to resize an image in a blob)
  <a href="https://stackoverflow.com/questions/23240467/resizing-image-in-google-apps-script">Resizing image in Google Apps Script</a></p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT :</strong></p>
  
  <p>Here is what I do now. But I have got a problem : the image is scaled down but not at the size I specify... </p>
  
  <pre><code> var response = UrlFetchApp.fetch(fileURL);
      var fileBlob = response.getBlob();
      var folder = DriveApp.getFolderById('THjgj698979XXXXXXXX');
       var docfile = Drive.Files.insert({
      title: "temp",
      mimeType: "application/vnd.google-apps.document",
    }).getId(); 
  
    var blobImage = DocumentApp.openById(docfile).insertImage(0, fileBlob);
  
    blobImage.setWidth(10);
    blobImage.setHeight(10);
  
     var fileBlob2 = blobImage.getBlob();  
    fileBlob2.setName(newFilename); 
  
    var result = folder.createFile(fileBlob2);
  </code></pre>
  
  <p>The image is scaled down from 4000x6000 to 2500x1667. Not to 10x10 :(</p>
  
  <p>Do you see how to fix this problem ?</p>
  
  <p>Thanks !</p>