Airtable Scripts to resize and crop images

Use Airtable Scripts and to resize and compress images with one click

In this video we'll walk through an Airtable Script that automatically resizes and compresses images using the API.  For this tutorial we brought in a special guest and old friend, Matt, a New Zealand based developer extraordinaire.

Other Links

Kraken Sign Up (referral link) :

Kraken API :

Kraken Image Options :


Copy this code with the button at the bottom.

//Trigger: User clicks button
// settings you change:
// ========================
let apiKey = "yourApiKeyHere";
let apiSecret = "yourSecretHere";
let originalFieldName = "Original";
let largeFieldName = "Large Web";
let largeWidth = 630;
let smallFieldName = "Small Web";
let smallWidth = 416;

// ========================
// Image resize code
// ========================

let table = base.getTable("Employees");
let record = await input.recordAsync("Select an Employee whose images you would like to create", table); 

// need an image there
if(record.getCellValue(originalFieldName) === null){	
		//console.log("Please upload an image for this record");
    output.text("Please upload an image for this record");

let imageToResizeUrl = record.getCellValue(originalFieldName)[0].url;

// send stuff to image processor
let callToKraken = await remoteFetchAsync('',
        method: 'POST',
        body: JSON.stringify(
                "auth": {
                    "api_key": apiKey,
                    "api_secret": apiSecret
                "wait": true,
                "lossy": true,
                "url": imageToResizeUrl,
                "resize": [
                        "id": "small",
                        "strategy": "landscape",
                        "width": smallWidth,
                        "id": "large",
                        "strategy": "landscape",
                        "width": largeWidth,
let returnedImages = await callToKraken.json();
// some debugging checks. Uncomment to view

//add images as attachments into Airtable row:
// "small" and "large" under "results" below are the IDs we specified in the Kraken body above
await table.updateRecordAsync(record, {
    [smallFieldName]: [ { url: returnedImages.results.small.kraked_url } ],
    [largeFieldName]: [ { url: returnedImages.results.large.kraked_url } ]