Convert and compress batch of images - problems with ShortPixel and Tinify

Hi all,

I’ve been learing Make.com this summer, with my first goal compressing and converting the images of a large collection list in Webflow. I’ve managed to do so for the spotlight images, and am now trying to do so for the multi image fields.

I’m running into two problems: the first one is in ShortPixel, where my first call to the API returns:

"Status": {
"Code": "1",
"Message": "Image scheduled for processing."
}

I’ve contacted them and they say that you have to run it twice, and indeed the second time I get the expected result, but it only works on batches of max 50 images, when the amount becomes too large the above return becomes dominant again. I’ve contacted them and they say I have to stick to max 50 images, implying it’s not built for large amounts of images. If someone is familiar with this kind of problem and can come up with a solution, please let me know, since this is the cheapest option and I’ve got to convert about 25.000 images.

Then I returned back to using Tinify. I got it to work in the most default way, just compressing, but I wasn’t able to figure out how to convert images to AVIF. The built-in converter module doesn’t feature AVIF unfortunately, and as soon as I added the following code in the body I received an error:

{
  "convert": { "type": "image/webp" }
}

I tried to sequence another API call and adding the above in the Body, but my problem is I can’t get the input URL from the preceding Tinify module to work. I’ve found this post of @samliew but after importing the blueprint I’m still not able to get it to work. His URL is:

{{first(map(1.headers; “value”; “name”; “location”))}}

I don’t understand it and can’t map it correctly (I mean I understand the function but I don’t understand the goal). I first tried to map the output location of the previous Tinify module directly, getting back an error. I also tried the above in many different ways, for instance also with “location” instead of “value” and removing the last two. I also tried to feed the slug, since that’s what’s being asked in the explanation of the URL field:

All with no result. Can someone shine a light on this, that would be great!

If there are other solutions feel free to share. I saw Picsart recommended here, but it seam to be more expensive.

edit: I both used the regular API call and the Tinify Make An API Call

I’ve made it a few steps further.

At this moment the ShortPixel route isn’t working out. Too many “Image scheduled for processing” messages.

Returned back to Tinify, and was finaly able to route the second Tinify module converting the optimized image to AVIF, where my problem was in getting the optimized image from the first Tinify module:

This returned a binary, as was already discussed in this topic. At this moment I’m able to convert this image to a file on Google Drive or Dropbox, using the “body” data to create a file.

The problem I’m having now is to retrieve the clean image link from either Drive or Dropbox. It’s not there in the output, and fiddling with the filename, removing the last part of the string etc. is just not working out. I only got it to work with the thumbnail image so far, and a larger image suddenly became a .jpeg out of nothing in Webflow…. I’ve been looking on the forum for help around this, but no clean solution yet, so anyone with advice would be welcome. Other modules that create online files from binaries are most welcome too of course.

In the meantime will check the ShortPixel route again.

1 Like

Sorry, I missed your question earlier and just saw this.

If you aggregate all your images to an array, you can use my “Chunk Array” module to return bundles of sub-arrays of the desired size.

My Custom AppAbsolutely Free!

Save headaches and operation credits with these utility modules:

  • Chunk Text
  • Chunk Array
  • Chunk Words
  • Multiple Find & Replace
  • Collection to Array/String List
  • Execute JavaScript
  • Estimate Tokens
  • Calculate Difference Between Two Dates
  • Get Next Business Day (with holidays)
  • List Upcoming Dates of Day of Week
    and more!

If you still require assistance with this, please provide more details in a new topic.

@samliew

1 Like