Scripting with the CLI (video tutorial)

Overview

Watch this tutorial to learn how to create an animated GIF using a Cloudinary CLI script.

Video tutorial


This video is brought to you by Cloudinary's video player - embed your own!

Tutorial contents

This tutorial presents the following topics. Click a timestamp to jump to that part of the video.

Create an animated GIF with an image and a script

Jump to this spot in the video  0:20 You can create an animated GIF that transforms the color saturation of an image. Begin with an image and a script.

Create a script

Jump to this spot in the video  0:32 In the script, increase the color saturation of an image and upload the image with the applied transformation.

Here is the script:

Copy to clipboard
#!/bin/bash

inc=10

# Increase the color saturation by 10 for each image
for ((sat = -100; sat <= 100; sat += 10))
do
      trans="transformation='{\"effect\": \"saturation:$sat\"}'"

      echo $trans

      # Upload the image with the applied transformation
      eval cld uploader upload umbrellas.jpg public_id="umbrellas_$inc" folder="color" overwrite=true tags="umbrella" $trans

      ((inc++))
done

cld uploader multi umbrella delay=100

Run the script

Jump to this spot in the video  0:42 Run the script to upload the image multiple times and increase the color saturation each time, giving each image a different public ID but the same tag.

Apply a command to create the animation

Jump to this spot in the video  1:30 Use the multi command to create the animation:
cld uploader multi umbrella delay=100

View your animated GIF

Jump to this spot in the video  1:46 Copy and paste the generated URL to view your animated GIF.

Keep learning

Related topics

If you like this, you might also like...

Get Started with the CLI
Set up the CLI and get familiar with some basic commands
Get Creative with the CLI
Create an image sprite from pages of a PDF
Upload with the CLI
Apply background removal to images on upload

 

Cloudinary Academy

 

Check out Cloudinary Academy for free self-paced Cloudinary courses on a variety of developer or DAM topics, or register for formal instructor-led courses, either virtual or on-site.

 

✔️ Feedback sent!

Rate this page: