To use the SDK in a Python project for cropping and resizing images stored in Cloudinary:
- Install the SDK:
pip install cloudinary- Add the necessary package references:
from cloudinary import CloudinaryImage
- Install the
python-dotenvlibrary for importing Cloudinary credentials into your project from a.envfile:
pip install python-dotenv-
Create a
.envfile in your project directory containing your Cloudinary API environment variable. Copy the API environment variable format from the API Keys Settings page. Replace <your_api_key> and <your_api_secret> with your actual values, while your cloud name is already correctly included in the format. -
Use the
python-dotenvlibrary to import your Cloudinary credentials into your project:
from dotenv import load_dotenv
load_dotenv()