Help

Save the date! Join us on October 16 for our Product Ops launch event. Register here.

Re: Image Processing (Resizing, Getting Metadata, Google Vision)

1747 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Martin_Kranz
6 - Interface Innovator
6 - Interface Innovator

I was wondering if anyone here has managed to write a piece of code in the scripting block to

  1. Resize an existing attachment file to match certain dimensions programmatically
  2. Obtain the pixel dimensions (height and width) of a image attachment
    and most interestingly
  3. Call Google Vision to run Image Analytics on a image attachment, pulling the results into a text or linked field in Airtable…

Cheers,
Martin

5 Replies 5

I don’t have any JavaScript scripts for this (other people might), but you can do all of this with no coding at all using Integromat’s image transformation & Google Cloud Vision modules:

p.s. I am an Airtable consultant and a Registered Integromat Partner. If you have a budget for your project and need to hire a consultant to set this up for you, feel free to contact me through my website at scottworld.com.

Yep - done all three and for one project.

It’s impractical to do this in Airtable itself because you need to employ different services for each of your three tasks. To do this, I used – you guessed it – Google Apps Script because it offers seamless integration with their image manipulation SDK, the Vision SDK, and image meta SDK.

It’s not a walk in the park but it can all be done in a single webhook service that Airtable calls (passing in the table name/record ID). Then the Airtable API is called back for the details, attachment URL, etc. The script performs all the tasks and sends the result s back to the same record (or does other stuff as needed).

One of the nice things about Google Apps Script is it can serve as an automation layer with an integrated custom webhook layer as well as script triggering - all for pretty much no charge and it scales vastly beyond the limitations of no-code integration services.

Fantastic. It looks like i got to embrace app scripts don’t i…
Since the resizing is actually a different step in my process and actually one that’s more important to tackle, whereas obtaining image dimensions and calling the google vision SDK is something to be looked into at a later stage…
Would this be possible purely in javascript code?

That’s how we did it - all Google Apps Script (javascript). It may be possible in Airtable (javascript) but not likely financially practical.

were you able to extract custom metadata (XMP) within that script?

I’m only able to grab this much, but I know there’s more.

{
“date”:“2019:11:09 14:11:09”,
“whiteBalance”:“Manual”,
“subjectDistance”:0,
“height”:3956,
“meteringMode”:“CenterWeightedAverage”,
“cameraModel”:“FC6520”,
“isoSpeed”:200,
“cameraMake”:“DJI”,
“exposureTime”:0.01,
“exposureBias”:1.65625,
“colorSpace”:“sRGB”,
“flashUsed”:false,
“rotation”:0,
“maxApertureValue”:1.69,
“aperture”:8,
“width”:5280,
“location”:{
“altitude”:131.602,
“latitude”:33.43046261111111,
“longitude”:-117.19567805555556
},
“exposureMode”:“Auto”,
“focalLength”:45
}