In order to resize an image with Parse Server, you can use the ‘beforeSave’ webhook on your entity. You first need to install the jimp npm package :

npm install --save jimp

(Note: This package may requires node-gyp, which may requires Python… I’ll let you google your way around the dependencies rabbit hole, but don’t hesitate to send me an email if you need any help)

The next step is to add this code into the main.js file of your Parse Cloud Code. For the sake of simplicity, the following piece of code assumes that your class is called ‘Entity’, containing a field named ‘resized_picture’, which is supposed to hold the resized image.

const Jimp = require("jimp");

Parse.Cloud.beforeSave("EntityName", async (request, response) => {
  try {
    const entity = request.object;
    let picture = entity.get("resized_picture");
    let image = await Jimp.read(picture.url());
    let width = 200;
    let height = 200;
    image.resize(width, height);
    let data = await image.getBase64Async(Jimp.MIME_PNG);
    let file = new Parse.File(picture.name(), { base64: data });
    await file.save();
    entity.set("resized_picture", file);
  } catch (e) {
    console.log(e);
  }
});

Your entity should now be updated with the field “resized_picture” containing the resized image. You can verify it by checking your Parse Dashboard, if you have it installed.