title: Image manipulation in Parse cloud code
body: <p>I have a simple table in Parse:</p>
  
  <p><a href="https://i.stack.imgur.com/ZH2kY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZH2kY.png" alt="enter image description here"></a></p>
  
  <p>I want to get the photo column, process the file and then save it in the coverPhoto column. This is what I got:</p>
  
  <pre><code>Parse.Cloud.define("testPhoto", function(request, response) {
  
    var query = new Parse.Query("ItemPhoto")
    query.get("62EmHGTb33", {
      success: function(object) {
        var image = new Image();
        image.setData(object.get('photo'));
        image.scale({
          width: 250
        });
        image.setFormat("JPEG");
        var base64 = image.toString("base64");
        var cropped = new Parse.File("cover.jpg", { base64: base64 });
        object.set("coverPhoto", cropped);
  
        object.save(null, {
          success: function(isave) {
            response.success("OK");
          },
          error: function(object, error) {
            response.error(error);
          }
        });
  
        //response.success(object.get('photo').url());
      },
  
      error: function(object, error) {
        response.error(error);
      }
    });
  
  });
  </code></pre>
  
  <p>I'm getting an error I don't know how to fix: <code>{"code":141,"error":"{\"code\":107,\"message\":\"base64 field cannot be decoded\"}"}</code></p>