Programmable Media

Scripting with the CLI (video tutorial)

Last updated: Sep-12-2024

Overview

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

Video tutorial


Video Player is loading.
Current Time 0:00
Duration -:-
Loaded: 0%
Stream Type LIVE
Remaining Time 0:00
 
1x
  • descriptions off, selected
  • captions off, selected

    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:

    #!/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...

     

    Cloudinary Academy

     

    Check out the 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!