Programmable Media

Upload images in Python (video tutorial)

Last updated: Dec-11-2024

Overview

Learn how to upload images in Python using the Cloudinary Python SDK.

Video tutorial


Tutorial contents

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

Introduction

Jump to this spot in the video  0:00 In this tutorial, you'll learn how to upload one or more images to Cloudinary using the Python SDK, a crucial part of your workflow.

Upload a single image from your local file system

Jump to this spot in the video  0:14 This tutorial assumes that you've already installed, imported and configured Cloudinary. If you need help with that, see Configure the Python SDK.
To upload, use the cloudinary.uploader.upload endpoint. Provide the full path of the image to upload as a parameter and store the response. Here's an example using a file named images/blue-sweater.jpg.

Upload response

Jump to this spot in the video  0:38 Execute your script to upload the image and display the response. You can access the image via the secure_url provided in the response.

Upload a single image from a remote URL

Jump to this spot in the video  0:48 Utilize the cloudinary.uploader.upload endpoint to upload an image from any web location by providing its URL as a parameter. The response will include a secure_url similar to the one obtained when uploading from the file system.

Upload multiple images from your local file system

Jump to this spot in the video  1:07 You can upload multiple images from your local file system by creating an array containing the paths of all the images you want to upload. Iterate through the array, calling cloudinary.uploader.upload for each image and passing its path as a parameter. Save the response. Although each image receives a full upload response, for simplicity, only print the secure_url.
Execute the script to upload the images and retrieve their delivery URLs. You can also view all uploaded images in the Media Library.

Keep learning

Related topics

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

Configure the Python SDK
Install and configure the Cloudinary Python SDK
Manage Images in a Django App
Use Django helper methods to upload, transform, and display assets.
Delete Assets with Node.js
Delete assets using various methods from the Node.js SDK

 

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!

Rate this page: