GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Cloudinary Docs Docs
  • Image & Video APIs
  • Guides
  • References
  • SDKs
  • Release Notes
  • Assets (DAM)
  • User Guides
  • Admin Guides
  • Assets APIs
  • Release Notes
  • MediaFlows
  • PowerFlows
  • EasyFlows

This view

  • Original page
  • New address

GeezerVison is showing cloudinary.com — JavaScript Image Transformations | Documentation

Documentation Index

Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt

Use this file to discover all available pages before exploring further.

  • Get Started
    • Image & Video APIs overview
    • AI Power Start
    • SDK Quick Starts
    • Developer Kickstart
      • Step 1: Register and find credentials
      • Step 2: Load pages faster with optimization
      • Step 3: Your first transformations
      • Step 4: Resize transformations
      • Step 5: Set up and run your first SDK project
      • Congrats! You're ready to code!
    • AI agents
      • Agents: start here
      • AI agent tools and MCP servers
    • Try it!
      • Sample apps
      • Feature demos
      • Postman collections
    • VS Code Extension
    • Video tutorial library
      • Programmatic asset management
        • Image onboarding
          • API key and secret
          • Image optimization basics
          • Background removal
          • Edits at scale
          • Programmatic upload
          • Pricing
        • Programmatic upload
          • Upload programmatically
          • Upload with Fetch API
          • Create upload presets (Node.js)
          • Create upload presets (Console UI)
          • Auto upload
          • Moderate images with AI
          • Use AI to generate image captions
          • Upload images in Flutter
          • Upload images in Node.js
          • Auto-tag images in Node.js
          • Upload multiple files in Node.js
          • Upload videos in Node.js
          • Upload images in Python
          • Auto-tag images in Python
          • Upload videos in Python
          • Upload images in PHP
          • Upload images in Go
          • Upload assets in a React app
          • Upload assets in a Vue.js app
          • Drag-and-drop uploads in React
          • Upload assets in a Next.js app
          • Upload assets with Server Actions
          • Upload assets in Svelte
          • Upload assets in a SvelteKit app
          • Upload assets in a Remix app
          • Upload images in Astro
          • Upload images in Hono
          • Use webhooks to remove backgrounds
          • Upload images in Laravel
        • Interaction with Cloudinary APIs
          • Generate upload signature
          • Postman collections introduction
        • Cloudinary SDKs
          • Find your credentials
          • Configure the JavaScript SDK
          • Configure the React SDK
          • Configure the Angular SDK
          • Configure the Flutter SDK
          • Configure Svelte Cloudinary
          • Configure the Javascript SDK in Svelte
          • Getting started with Cloudinary in Node.js
          • Configure the Node.js SDK
          • Configure the Python SDK
          • Configure the PHP SDK
          • Install and configure Laravel SDK
          • Configure the Go SDK
          • Configure the Vue.js SDK
          • Configure the Next.js SDK
          • List images in Next.js
          • Lazy load images with Next.js
          • Add images to Sanity with Next.js
          • Image fallbacks in JavaScript
          • Captioning on upload with Node.js
          • Create PDFs from images in Node.js
          • Delete assets with Node.js
          • Manage images in a Django app
          • Image gallery with Astro
        • Cloudinary CLI
          • Get started with the CLI
          • Scripting with the CLI
          • Upload with the CLI
        • Widgets and tools
          • Upload Widget
          • Product Gallery
          • Product Gallery in React
          • Product Gallery accessibility
          • VS Code extension
      • Optimization and delivery
        • Programmatic optimization
          • Optimization tips
          • Optimize images in React
          • Optimize videos in React
          • Transform and optimize images in Svelte
          • Optimize videos in Next.js
          • Next.js image optimization
          • Optimize images with Nuxt Cloudinary
          • Optimize images in SolidJS with Cloudinary
          • Optimize images in Flutter
          • Optimize images in Laravel
        • Programmatic delivery
          • Deliver images with the Next.js Image component
          • Deliver images with the Nuxt Image component
          • Diagnosing error codes
        • Video Player
          • Video Player in React
          • Video Player in Next.js
          • ABR streaming in Next.js
          • Video Player in HTML
          • Video Player in Svelte
      • Transformations
        • Get started with transformations
          • Transformation basics
          • Transformation Builder
          • Gravity-based crops for images
          • Enhance and restore images
          • Transformation overlays
          • Content-aware image cropping
          • Content-aware video cropping
          • Convert videos to animated images
        • Advanced transformation features
          • Text overlay transformations
          • Add watermarks in JavaScript
          • Complex transformations
          • Named transformations
          • Advanced image components
          • Trim videos in Node.js
          • Splice videos in Node.js
          • Zoompan effect
          • Video transformations
          • Crop and resize images in React
          • Crop and resize videos in React
          • Crop and resize images in Python
          • Crop images in PHP
          • Remove backgrounds and add drop shadows
          • AI generative fill in Next.js
          • Color accessibility in JavaScript
        • Transformations for social media
          • Social media image cards in Next.js
          • Social media image cards in Svelte
      • Dev Hints on YouTube
      • Dev Hints en Español
      • Cloudinary Café Training Sessions
    • Additional onboarding resources
      • Service introduction
      • Onboarding FAQ
        • Enterprise onboarding FAQ
          • Migration guide
          • Glossary
      • Guides
        • Cloudinary Image
          • Product overview
          • Image transformations
            • Image transformations overview
            • Named transformations
            • Transformation rollout
            • Image format support
            • Delivery types and flags
            • Transformation types
            • Resizing and cropping
              • Overview
              • Crop modes
              • Resize modes
              • Padding modes
              • Gravity for crops
              • Automatic gravity
              • Upscaling and downscaling
            • Placing layers on images
              • Layer syntax
              • Layer placement
                • Side-by-Side, vertical, and collage layouts
              • Text layer options
                • Custom and special fonts
                • Advanced text layer options
              • Transforming layers
              • Underlays, watermarking, and special effects
            • Effects and enhancements
              • Overview
              • Image enhancement
              • Color effects
              • Artistic effects
              • Reshaping and distorting
                • Displacement, rotation, rounding, and zoompan
                • Image distortion
                • Shape cutouts
            • Background removal
            • Generative AI transformations
              • Background replace
              • Fill
              • Recolor
              • Remove
              • Replace
              • Restore
            • Face-detection based transformations
            • Advanced image transformations
              • Custom focus areas
              • Transformation refiners
              • Animated images
              • Transformations on 3D models
              • Conditional transformations
                • Specifying conditions
                • Specifying transformations for a condition
                • Advanced conditional transformations
              • User-defined variables and arithmetic transformations
              • Custom functions
            • Image transformation recipes
              • Crop around a person's full body
              • Add a horizontal line
              • Resize with percentage padding on a canvas
              • Instagram Story with photo and text
              • Add a solid color shape over an image
              • Offset the crop position around a face
          • Image optimization and delivery
            • Optimization overview
            • Image optimization
              • Image optimization basics
              • PDF optimization
              • Optimize by default
            • Responsive images
              • Using HTML and dynamic image transformations
              • Using JavaScript frontend frameworks
              • Using the cloudinary-core JS library
              • Using client hints
            • Deliver remote media files
              • Social media profile pictures
            • PDF and Photoshop files
            • Media access methods
            • CDN delivery options
          • Programmatic image creation
            • Animated images
            • Archives
            • PDF files from images
            • Images from text
          • Product Gallery widget
            • Product Gallery changelog
          • Media Editor widget
          • Image add-ons
          • Troubleshooting and tips
            • Troubleshooting image transformation and delivery errors
            • Menu Title
            • Images delivered without gzip compression
            • Long time to first byte (TTFB) on WebPageTest.org
            • Update a named transformation
            • Cloudinary vs Imagga cropping
            • Placeholder images (LQIP)
            • How to detect corrupted images
            • Force specific image when sharing links on Facebook
            • Blurry images
        • Cloudinary Video
          • Product overview
          • Cloudinary Video Player
            • Video Player features
            • When to use the video player
            • Installation and setup
            • How to embed the Video Player
            • Video Player Studio
            • Video Player customization
            • Playlists and recommendations
            • HLS and MPEG-DASH
            • Video Player accessibility
            • Video Player advanced features
              • Events and analytics
              • Video ads and monetization
              • Shoppable Video
              • Interactive Video (Beta)
            • Video Player API reference
            • Player Profiles API reference
            • Video Config API reference
          • Adaptive bitrate streaming
          • Video transformations
            • Video transformations overview
            • Named transformations
            • Transformation rollout
            • Video Canvas
            • Transcoding and formats
            • Delivery types and flags
            • Transformation types
            • Resizing and cropping
              • Overview
              • Crop modes
              • Resize modes
              • Gravity for crops
            • Trimming and concatenating
              • Overview
              • Trimming
              • Concatenation
              • Transition effects
            • Placing layers on videos
              • Layer syntax
              • Layer placement
              • Text layer options
                • Custom and special fonts
                • Advanced text layer options
              • Transforming layers
              • Underlays, watermarking, and special effects
            • Effects and enhancements
              • Overview
              • Color effects
              • Artistic effects
              • Playback effects
              • Reshaping and rotating
              • Previews and posters
            • Audio transformations
            • Advanced video transformations
              • Converting videos to animated images
              • Conditional transformations
                • Specifying conditions
                • Specifying transformations for a condition
                • Advanced conditional transformations
              • User-defined variables and arithmetic transformations
            • Video transformation recipes
              • White background looping GIF
              • Add a logo or watermark to a video
              • Resize a video for social media
              • Create a poster image from a video frame
          • Video and audio optimization
            • Video optimization
            • Adaptive bitrate streaming
            • Audio optimization
          • Video transcription
          • AI Video Analysis
          • AI Video Analysis API reference
          • Video analytics
          • Live streaming
            • Live Streaming API reference
            • Simulated live streaming
          • Video add-ons
          • Video best practices
          • Social media videos
          • Troubleshooting and tips
            • Troubleshooting video transformation errors
            • Video duration missing on first play
            • Remove codec from Content-Type
        • Upload
          • Uploading assets
          • Customizing uploads
          • Post-upload processing
          • Client-side uploading
          • Upload presets
          • Upload widget
            • Upload widget changelog
          • Troubleshooting and tips
            • Unsigned upload from Google Apps Script
            • Rejected file formats
            • Troubleshooting failed upload requests
            • Always upload a square image
            • Unsupported parameters in unsigned uploads
            • Uploaded image truncated
            • Upload failed - cloud_name is disabled error
            • Upload with FileMaker
        • Asset management
          • CRUD asset management APIs
            • List assets
            • Update assets
            • Delete assets
            • Rename assets
            • Relate assets
          • Media Library for developers
          • Search for assets
            • Search API method
            • Cacheable search URLs
            • Visual Search
            • Search expressions
          • Eager and incoming transformations
          • Custom metadata
            • Tags
            • Contextual metadata
            • Structured metadata
              • Conditional metadata rules
          • Analyze assets
            • Image quality analysis
            • Accessibility analysis
            • Semantic data extraction
            • Media Inspector
            • Analyze API (Beta)
          • Moderate assets
          • Webhook notifications
          • Advanced asset management
            • Signatures
              • Authentication signatures
              • Notification signatures
              • Delivery URL signatures
              • Response signatures
            • Provenance and authenticity
            • Backups and version management
            • Invalidate cached assets
          • Add-ons
          • Troubleshooting and tips
            • Admin API authentication issues
            • Why has the public ID of my asset changed?
            • Asset ID vs public ID
            • Check resource type and delivery type
            • Get image or video dimensions
            • Download account assets
            • Delete or modify original images
            • Does Cloudinary store any cookies?
            • Underscores in public IDs or folder names
            • Update already fetched asset
            • Upload, manage, and deliver PDFs
            • Cloudinary "sample" images
            • Avoiding duplicate uploads
            • Permitted naming conventions
            • Adult/NSFW content policy
            • High transformation rate
        • Account management
          • Account settings
            • Folder modes
          • Product environment settings
          • User provisioning
            • SAML SSO
          • Billing and plans
          • Roles and Permissions
            • Migrating to Roles and Permissions
              • Legacy permissions
            • Manage & assign roles in the Console
            • Roles and Permissions via API
              • Manage roles
              • Assign roles
              • Define custom policies
            • System roles and policies list
          • Usage data
          • How are transformations counted?
          • Troubleshooting and tips
            • Cancel or delete Cloudinary account
            • Sign up or add user with existing email
            • Credit card payments
            • Recover disabled account
            • Can't downgrade my plan
            • Migrate Media Optimizer account
            • Why did my usage spike?
            • Rotate API keys in the Console
            • Successfully go live with Cloudinary
            • Bot traffic and access control
        • Retail and e-commerce
          • Best practices
          • Visual differentiators
          • Customize and optimize assets
          • Workflows
            • Product asset workflows
            • Non-product asset workflows
            • Multi-channel content delivery
        • User-generated content
          • Overview
          • Upload
          • Manage and analyze
          • Transform and customize
          • Optimize and deliver
          • Profile picture sample project
          • Video review sample project
          • Marketplace products sample project
          • Try before you buy sample project
            • Delete temporary UGC assets
        • Accessible media
          • Overview
          • Image accessibility
          • Video and audio accessibility
          • Image and video adaptability
          • Visual and audio clarity
            • Color accessibility
            • Text, contrast, and color
            • Audio controls and mixing
          • Interactive content and controls
        • AI in action
        • Native mobile
        • Add-ons
          • Advanced Facial Attributes Detection
          • Amazon Rekognition AI Moderation
          • Amazon Rekognition Video Moderation
          • Amazon Rekognition Auto Tagging
          • Amazon Rekognition Celebrity Detection
          • Aspose Document Conversion
          • Cloudinary AI Background Removal
          • Cloudinary AI Content Analysis
            • Overview
            • Object-aware cropping
            • Automatic image tagging
            • Image analysis
          • Cloudinary AI Vision
          • Cloudinary Duplicate Image Detection
          • Cloudinary Image Generation
          • Google AI Video Moderation
          • Google AI Video Transcription
          • Google Auto Tagging
          • Google Automatic Video Tagging
          • Google Translation
          • Image to Video
          • Image to Video API reference
          • Imagga Auto Tagging
          • Imagga Crop and Scale
          • Perception Point Malware Detection
          • Microsoft Azure Video Indexer
          • OCR Text Detection and Extraction
          • Pixelz - Remove the Background
          • URL2PNG Website Screenshots
          • VIESUS™ Automatic Image Enhancement
          • WebPurify Image Moderation
      • References
        • Transformation URL API
        • Upload API
        • Admin API
        • Cloudinary CLI
        • Image APIs
          • Analyze API (Beta)
          • Image Generation API
        • Video APIs
          • AI Video Analysis API (Beta)
          • Image to Video API
          • Live Streaming API
          • Player Profiles API
          • Video Canvas API
          • Video Config API
          • Video Player API
        • Widget APIs
          • Media Editor API
          • Media Library Widget API
          • Product Gallery API
          • Studio Widget API
          • Upload Widget API
        • Account management APIs
          • Agent account creation API
          • Claimable Cloud API
          • Permissions API
          • Provisioning API
        • SDK references
          • Angular SDK reference
          • Dart SDK reference
          • Flutter SDK reference
          • Go SDK reference
          • JavaScript SDK reference
          • PHP SDK reference
          • React SDK reference
          • Transformation Builder reference
          • Vue.js SDK reference
        • Postman collections
      • SDKs
        • Backend SDKs
          • Node.js SDK
            • Node.js introduction
            • Node.js quick start
            • Node.js image and video upload
            • Node.js image transformations
            • Node.js video transformations
            • Node.js asset management
            • Node.js sample projects
            • Node.js video tutorials
          • Python SDK
            • Python introduction
            • Python quick start
            • Python image and video upload
            • Python image transformations
            • Python video transformations
            • Python asset management
            • Python sample projects
            • Python video tutorials
          • PHP SDK
            • PHP introduction
            • PHP quick start
            • PHP image and video upload
            • PHP image transformations
            • PHP video transformations
            • PHP asset management
            • PHP sample projects
            • PHP video tutorials
            • PHP Management reference
            • PHP Transformation reference
          • Java SDK
            • Java introduction
            • Java quick start
            • Java image and video upload
            • Java image transformations
            • Java video transformations
            • Java asset management
          • Ruby/Rails SDK
            • Ruby/Rails introduction
            • Ruby/Rails quick start
            • Ruby/Rails image and video upload
            • Ruby/Rails image transformations
            • Ruby/Rails video transformations
            • Ruby/Rails asset management
            • CarrierWave integration
            • Attachinary integration
            • Active Storage integration
          • .NET SDK
            • .NET introduction
            • .NET quick start
            • .NET image and video upload
            • .NET image transformations
            • .NET video transformations
            • .NET asset management
          • Go SDK
            • Go introduction
            • Go quick start
            • Go image and video upload
            • Go media transformations
            • Go asset management
            • Go sample projects
            • Go video tutorials
            • Go SDK reference
          • Dart SDK
            • Dart introduction
            • Dart quick start
            • Dart image and video upload
            • Dart media transformations
            • Dart SDK reference
        • Frontend SDKs
          • React SDK
            • React introduction
            • React Starter Kit
            • React quick start
            • React image and video upload
            • React image transformations
            • React video transformations
            • React sample projects
            • React video tutorials
            • React SDK reference
            • Transformation Builder reference
          • Vue.js SDK
            • Vue.js introduction
            • Vue.js quick start
            • Vue.js image and video upload
            • Vue.js image transformations
            • Vue.js video transformations
            • Vue.js sample projects
            • Vue.js video tutorials
            • Vue.js SDK reference
            • Transformation Builder reference
          • Angular SDK
            • Angular introduction
            • Angular quick start
            • Angular image and video upload
            • Angular image transformations
            • Angular video transformations
            • Angular sample projects
            • Angular video tutorials
            • Angular SDK reference
            • Transformation Builder reference
          • JavaScript SDK
            • JavaScript introduction
            • JavaScript quick start
            • JavaScript image and video upload
            • JavaScript image transformations
            • JavaScript video transformations
            • JavaScript sample projects
            • JavaScript video tutorials
            • JavaScript SDK reference
            • Transformation Builder reference
          • Next.js SDK
            • Next.js introduction
            • Next.js Starter Kit
            • Next.js quick start
            • Next.js image and video upload
            • Next.js image transformations
            • Next.js video transformations
            • Next.js sample projects
            • Next.js video tutorials
          • jQuery SDK
            • jQuery introduction
            • jQuery image and video upload
            • jQuery image transformations
            • jQuery video transformations
          • React SDK (Legacy)
            • React introduction
            • React image and video upload
            • React image transformations
            • React video transformations
            • React migration guide
          • Vue.js SDK (Legacy)
            • Vue.js introduction
            • Vue.js image and video upload
            • Vue.js image transformations
            • Vue.js video transformations
            • Vue.js migration guide
          • Angular SDK (Legacy)
            • Angular introduction
            • Angular image and video upload
            • Angular image transformations
            • Angular video transformations
            • Angular migration guide
          • JavaScript SDK (Legacy)
            • JavaScript introduction
            • JavaScript image and video upload
            • JavaScript image transformations
            • JavaScript video transformations
            • JavaScript migration guide
        • Mobile SDKs
          • iOS SDK
            • iOS introduction
            • iOS quick start
            • iOS image and video upload
            • iOS image transformations
            • iOS video transformations
            • iOS video player
            • iOS sample projects
          • Android SDK
            • Android introduction
            • Android quick start
            • Android image and video upload
            • Android image transformations
            • Android video transformations
            • Android video player
            • Android sample projects
          • Flutter SDK
            • Flutter introduction
            • Flutter quick start
            • Flutter image and video upload
            • Flutter media transformations
            • Flutter video player
            • Flutter video tutorials
            • Dart-based cloudinary_url_gen package reference
            • Flutter SDK reference
          • React Native SDK
            • React Native introduction
            • React Native image and video upload
            • React Native image transformations
            • React Native video transformations
            • React Native video player
          • Kotlin SDK
            • Kotlin introduction
            • Kotlin media transformations
        • Community-developed libraries
          • Astro
          • Laravel
          • NuxtJS
          • Svelte
          • Gatsby
          • Netlify
          • Drupal
      • Release Notes
        • Latest: October 31, 2026
        • August 31, 2026
        • July 9, 2026
        • Previous releases
          • May 28, 2026
          • April 7, 2026
          • February 28, 2026
          • January 30, 2026
          • 2025
            • December 18, 2025
            • October 31, 2025
            • September 3, 2025
            • July 09, 2025
            • May 27, 2025
          • 2024
            • November 29, 2024
            • October 9, 2024
            • August 12, 2024
            • June 27, 2024
            • May 31, 2024
            • April 16, 2024
            • February 28, 2024
            • January 03, 2024
          • 2023
            • November 13, 2023
            • October 26, 2023
            • September 21, 2023
            • August 15, 2023
            • July 13, 2023
            • June 19, 2023
            • May 16, 2023
            • Apr 04, 2023
            • Feb 21, 2023
          • 2022
            • Dec 27, 2022
      Image & Video APIs
      • Get Started
      • Guides
      • References
      • SDKs
      • Release Notes
      Assets (DAM)
      • Get Started
      • User Guides
      • Admin Guides
      • Assets APIs
      • Release Notes
      MediaFlows
      • Get Started
      • PowerFlows
      • EasyFlows
      • Release Notes
    • More Products
        Integrations
        Add Cloudinary capabilities to your tech stack apps and platforms
        Cloudinary Moderation
        AI-powered visual quality and brand checks
    • Resources
        Blog
        Training
        Support
        Demos
        Additional Resources
    • Pricing
      sign up for free
      Menu
      • Get Started
        • Image & Video APIs overview
        • AI Power Start
        • SDK Quick Starts
        • Developer Kickstart
          • Step 1: Register and find credentials
          • Step 2: Load pages faster with optimization
          • Step 3: Your first transformations
          • Step 4: Resize transformations
          • Step 5: Set up and run your first SDK project
          • Congrats! You're ready to code!
        • AI agents
          • Agents: start here
          • AI agent tools and MCP servers
        • Try it!
          • Sample apps
          • Feature demos
          • Postman collections
        • VS Code Extension
        • Video tutorial library
          • Programmatic asset management
            • Image onboarding
              • API key and secret
              • Image optimization basics
              • Background removal
              • Edits at scale
              • Programmatic upload
              • Pricing
            • Programmatic upload
              • Upload programmatically
              • Upload with Fetch API
              • Create upload presets (Node.js)
              • Create upload presets (Console UI)
              • Auto upload
              • Moderate images with AI
              • Use AI to generate image captions
              • Upload images in Flutter
              • Upload images in Node.js
              • Auto-tag images in Node.js
              • Upload multiple files in Node.js
              • Upload videos in Node.js
              • Upload images in Python
              • Auto-tag images in Python
              • Upload videos in Python
              • Upload images in PHP
              • Upload images in Go
              • Upload assets in a React app
              • Upload assets in a Vue.js app
              • Drag-and-drop uploads in React
              • Upload assets in a Next.js app
              • Upload assets with Server Actions
              • Upload assets in Svelte
              • Upload assets in a SvelteKit app
              • Upload assets in a Remix app
              • Upload images in Astro
              • Upload images in Hono
              • Use webhooks to remove backgrounds
              • Upload images in Laravel
            • Interaction with Cloudinary APIs
              • Generate upload signature
              • Postman collections introduction
            • Cloudinary SDKs
              • Find your credentials
              • Configure the JavaScript SDK
              • Configure the React SDK
              • Configure the Angular SDK
              • Configure the Flutter SDK
              • Configure Svelte Cloudinary
              • Configure the Javascript SDK in Svelte
              • Getting started with Cloudinary in Node.js
              • Configure the Node.js SDK
              • Configure the Python SDK
              • Configure the PHP SDK
              • Install and configure Laravel SDK
              • Configure the Go SDK
              • Configure the Vue.js SDK
              • Configure the Next.js SDK
              • List images in Next.js
              • Lazy load images with Next.js
              • Add images to Sanity with Next.js
              • Image fallbacks in JavaScript
              • Captioning on upload with Node.js
              • Create PDFs from images in Node.js
              • Delete assets with Node.js
              • Manage images in a Django app
              • Image gallery with Astro
            • Cloudinary CLI
              • Get started with the CLI
              • Scripting with the CLI
              • Upload with the CLI
            • Widgets and tools
              • Upload Widget
              • Product Gallery
              • Product Gallery in React
              • Product Gallery accessibility
              • VS Code extension
          • Optimization and delivery
            • Programmatic optimization
              • Optimization tips
              • Optimize images in React
              • Optimize videos in React
              • Transform and optimize images in Svelte
              • Optimize videos in Next.js
              • Next.js image optimization
              • Optimize images with Nuxt Cloudinary
              • Optimize images in SolidJS with Cloudinary
              • Optimize images in Flutter
              • Optimize images in Laravel
            • Programmatic delivery
              • Deliver images with the Next.js Image component
              • Deliver images with the Nuxt Image component
              • Diagnosing error codes
            • Video Player
              • Video Player in React
              • Video Player in Next.js
              • ABR streaming in Next.js
              • Video Player in HTML
              • Video Player in Svelte
          • Transformations
            • Get started with transformations
              • Transformation basics
              • Transformation Builder
              • Gravity-based crops for images
              • Enhance and restore images
              • Transformation overlays
              • Content-aware image cropping
              • Content-aware video cropping
              • Convert videos to animated images
            • Advanced transformation features
              • Text overlay transformations
              • Add watermarks in JavaScript
              • Complex transformations
              • Named transformations
              • Advanced image components
              • Trim videos in Node.js
              • Splice videos in Node.js
              • Zoompan effect
              • Video transformations
              • Crop and resize images in React
              • Crop and resize videos in React
              • Crop and resize images in Python
              • Crop images in PHP
              • Remove backgrounds and add drop shadows
              • AI generative fill in Next.js
              • Color accessibility in JavaScript
            • Transformations for social media
              • Social media image cards in Next.js
              • Social media image cards in Svelte
          • Dev Hints on YouTube
          • Dev Hints en Español
          • Cloudinary Café Training Sessions
        • Additional onboarding resources
          • Service introduction
          • Onboarding FAQ
            • Enterprise onboarding FAQ
              • Migration guide
              • Glossary
          • Guides
            • Cloudinary Image
              • Product overview
              • Image transformations
                • Image transformations overview
                • Named transformations
                • Transformation rollout
                • Image format support
                • Delivery types and flags
                • Transformation types
                • Resizing and cropping
                  • Overview
                  • Crop modes
                  • Resize modes
                  • Padding modes
                  • Gravity for crops
                  • Automatic gravity
                  • Upscaling and downscaling
                • Placing layers on images
                  • Layer syntax
                  • Layer placement
                    • Side-by-Side, vertical, and collage layouts
                  • Text layer options
                    • Custom and special fonts
                    • Advanced text layer options
                  • Transforming layers
                  • Underlays, watermarking, and special effects
                • Effects and enhancements
                  • Overview
                  • Image enhancement
                  • Color effects
                  • Artistic effects
                  • Reshaping and distorting
                    • Displacement, rotation, rounding, and zoompan
                    • Image distortion
                    • Shape cutouts
                • Background removal
                • Generative AI transformations
                  • Background replace
                  • Fill
                  • Recolor
                  • Remove
                  • Replace
                  • Restore
                • Face-detection based transformations
                • Advanced image transformations
                  • Custom focus areas
                  • Transformation refiners
                  • Animated images
                  • Transformations on 3D models
                  • Conditional transformations
                    • Specifying conditions
                    • Specifying transformations for a condition
                    • Advanced conditional transformations
                  • User-defined variables and arithmetic transformations
                  • Custom functions
                • Image transformation recipes
                  • Crop around a person's full body
                  • Add a horizontal line
                  • Resize with percentage padding on a canvas
                  • Instagram Story with photo and text
                  • Add a solid color shape over an image
                  • Offset the crop position around a face
              • Image optimization and delivery
                • Optimization overview
                • Image optimization
                  • Image optimization basics
                  • PDF optimization
                  • Optimize by default
                • Responsive images
                  • Using HTML and dynamic image transformations
                  • Using JavaScript frontend frameworks
                  • Using the cloudinary-core JS library
                  • Using client hints
                • Deliver remote media files
                  • Social media profile pictures
                • PDF and Photoshop files
                • Media access methods
                • CDN delivery options
              • Programmatic image creation
                • Animated images
                • Archives
                • PDF files from images
                • Images from text
              • Product Gallery widget
                • Product Gallery changelog
              • Media Editor widget
              • Image add-ons
              • Troubleshooting and tips
                • Troubleshooting image transformation and delivery errors
                • Menu Title
                • Images delivered without gzip compression
                • Long time to first byte (TTFB) on WebPageTest.org
                • Update a named transformation
                • Cloudinary vs Imagga cropping
                • Placeholder images (LQIP)
                • How to detect corrupted images
                • Force specific image when sharing links on Facebook
                • Blurry images
            • Cloudinary Video
              • Product overview
              • Cloudinary Video Player
                • Video Player features
                • When to use the video player
                • Installation and setup
                • How to embed the Video Player
                • Video Player Studio
                • Video Player customization
                • Playlists and recommendations
                • HLS and MPEG-DASH
                • Video Player accessibility
                • Video Player advanced features
                  • Events and analytics
                  • Video ads and monetization
                  • Shoppable Video
                  • Interactive Video (Beta)
                • Video Player API reference
                • Player Profiles API reference
                • Video Config API reference
              • Adaptive bitrate streaming
              • Video transformations
                • Video transformations overview
                • Named transformations
                • Transformation rollout
                • Video Canvas
                • Transcoding and formats
                • Delivery types and flags
                • Transformation types
                • Resizing and cropping
                  • Overview
                  • Crop modes
                  • Resize modes
                  • Gravity for crops
                • Trimming and concatenating
                  • Overview
                  • Trimming
                  • Concatenation
                  • Transition effects
                • Placing layers on videos
                  • Layer syntax
                  • Layer placement
                  • Text layer options
                    • Custom and special fonts
                    • Advanced text layer options
                  • Transforming layers
                  • Underlays, watermarking, and special effects
                • Effects and enhancements
                  • Overview
                  • Color effects
                  • Artistic effects
                  • Playback effects
                  • Reshaping and rotating
                  • Previews and posters
                • Audio transformations
                • Advanced video transformations
                  • Converting videos to animated images
                  • Conditional transformations
                    • Specifying conditions
                    • Specifying transformations for a condition
                    • Advanced conditional transformations
                  • User-defined variables and arithmetic transformations
                • Video transformation recipes
                  • White background looping GIF
                  • Add a logo or watermark to a video
                  • Resize a video for social media
                  • Create a poster image from a video frame
              • Video and audio optimization
                • Video optimization
                • Adaptive bitrate streaming
                • Audio optimization
              • Video transcription
              • AI Video Analysis
              • AI Video Analysis API reference
              • Video analytics
              • Live streaming
                • Live Streaming API reference
                • Simulated live streaming
              • Video add-ons
              • Video best practices
              • Social media videos
              • Troubleshooting and tips
                • Troubleshooting video transformation errors
                • Video duration missing on first play
                • Remove codec from Content-Type
            • Upload
              • Uploading assets
              • Customizing uploads
              • Post-upload processing
              • Client-side uploading
              • Upload presets
              • Upload widget
                • Upload widget changelog
              • Troubleshooting and tips
                • Unsigned upload from Google Apps Script
                • Rejected file formats
                • Troubleshooting failed upload requests
                • Always upload a square image
                • Unsupported parameters in unsigned uploads
                • Uploaded image truncated
                • Upload failed - cloud_name is disabled error
                • Upload with FileMaker
            • Asset management
              • CRUD asset management APIs
                • List assets
                • Update assets
                • Delete assets
                • Rename assets
                • Relate assets
              • Media Library for developers
              • Search for assets
                • Search API method
                • Cacheable search URLs
                • Visual Search
                • Search expressions
              • Eager and incoming transformations
              • Custom metadata
                • Tags
                • Contextual metadata
                • Structured metadata
                  • Conditional metadata rules
              • Analyze assets
                • Image quality analysis
                • Accessibility analysis
                • Semantic data extraction
                • Media Inspector
                • Analyze API (Beta)
              • Moderate assets
              • Webhook notifications
              • Advanced asset management
                • Signatures
                  • Authentication signatures
                  • Notification signatures
                  • Delivery URL signatures
                  • Response signatures
                • Provenance and authenticity
                • Backups and version management
                • Invalidate cached assets
              • Add-ons
              • Troubleshooting and tips
                • Admin API authentication issues
                • Why has the public ID of my asset changed?
                • Asset ID vs public ID
                • Check resource type and delivery type
                • Get image or video dimensions
                • Download account assets
                • Delete or modify original images
                • Does Cloudinary store any cookies?
                • Underscores in public IDs or folder names
                • Update already fetched asset
                • Upload, manage, and deliver PDFs
                • Cloudinary "sample" images
                • Avoiding duplicate uploads
                • Permitted naming conventions
                • Adult/NSFW content policy
                • High transformation rate
            • Account management
              • Account settings
                • Folder modes
              • Product environment settings
              • User provisioning
                • SAML SSO
              • Billing and plans
              • Roles and Permissions
                • Migrating to Roles and Permissions
                  • Legacy permissions
                • Manage & assign roles in the Console
                • Roles and Permissions via API
                  • Manage roles
                  • Assign roles
                  • Define custom policies
                • System roles and policies list
              • Usage data
              • How are transformations counted?
              • Troubleshooting and tips
                • Cancel or delete Cloudinary account
                • Sign up or add user with existing email
                • Credit card payments
                • Recover disabled account
                • Can't downgrade my plan
                • Migrate Media Optimizer account
                • Why did my usage spike?
                • Rotate API keys in the Console
                • Successfully go live with Cloudinary
                • Bot traffic and access control
            • Retail and e-commerce
              • Best practices
              • Visual differentiators
              • Customize and optimize assets
              • Workflows
                • Product asset workflows
                • Non-product asset workflows
                • Multi-channel content delivery
            • User-generated content
              • Overview
              • Upload
              • Manage and analyze
              • Transform and customize
              • Optimize and deliver
              • Profile picture sample project
              • Video review sample project
              • Marketplace products sample project
              • Try before you buy sample project
                • Delete temporary UGC assets
            • Accessible media
              • Overview
              • Image accessibility
              • Video and audio accessibility
              • Image and video adaptability
              • Visual and audio clarity
                • Color accessibility
                • Text, contrast, and color
                • Audio controls and mixing
              • Interactive content and controls
            • AI in action
            • Native mobile
            • Add-ons
              • Advanced Facial Attributes Detection
              • Amazon Rekognition AI Moderation
              • Amazon Rekognition Video Moderation
              • Amazon Rekognition Auto Tagging
              • Amazon Rekognition Celebrity Detection
              • Aspose Document Conversion
              • Cloudinary AI Background Removal
              • Cloudinary AI Content Analysis
                • Overview
                • Object-aware cropping
                • Automatic image tagging
                • Image analysis
              • Cloudinary AI Vision
              • Cloudinary Duplicate Image Detection
              • Cloudinary Image Generation
              • Google AI Video Moderation
              • Google AI Video Transcription
              • Google Auto Tagging
              • Google Automatic Video Tagging
              • Google Translation
              • Image to Video
              • Image to Video API reference
              • Imagga Auto Tagging
              • Imagga Crop and Scale
              • Perception Point Malware Detection
              • Microsoft Azure Video Indexer
              • OCR Text Detection and Extraction
              • Pixelz - Remove the Background
              • URL2PNG Website Screenshots
              • VIESUS™ Automatic Image Enhancement
              • WebPurify Image Moderation
          • References
            • Transformation URL API
            • Upload API
            • Admin API
            • Cloudinary CLI
            • Image APIs
              • Analyze API (Beta)
              • Image Generation API
            • Video APIs
              • AI Video Analysis API (Beta)
              • Image to Video API
              • Live Streaming API
              • Player Profiles API
              • Video Canvas API
              • Video Config API
              • Video Player API
            • Widget APIs
              • Media Editor API
              • Media Library Widget API
              • Product Gallery API
              • Studio Widget API
              • Upload Widget API
            • Account management APIs
              • Agent account creation API
              • Claimable Cloud API
              • Permissions API
              • Provisioning API
            • SDK references
              • Angular SDK reference
              • Dart SDK reference
              • Flutter SDK reference
              • Go SDK reference
              • JavaScript SDK reference
              • PHP SDK reference
              • React SDK reference
              • Transformation Builder reference
              • Vue.js SDK reference
            • Postman collections
          • SDKs
            • Backend SDKs
              • Node.js SDK
                • Node.js introduction
                • Node.js quick start
                • Node.js image and video upload
                • Node.js image transformations
                • Node.js video transformations
                • Node.js asset management
                • Node.js sample projects
                • Node.js video tutorials
              • Python SDK
                • Python introduction
                • Python quick start
                • Python image and video upload
                • Python image transformations
                • Python video transformations
                • Python asset management
                • Python sample projects
                • Python video tutorials
              • PHP SDK
                • PHP introduction
                • PHP quick start
                • PHP image and video upload
                • PHP image transformations
                • PHP video transformations
                • PHP asset management
                • PHP sample projects
                • PHP video tutorials
                • PHP Management reference
                • PHP Transformation reference
              • Java SDK
                • Java introduction
                • Java quick start
                • Java image and video upload
                • Java image transformations
                • Java video transformations
                • Java asset management
              • Ruby/Rails SDK
                • Ruby/Rails introduction
                • Ruby/Rails quick start
                • Ruby/Rails image and video upload
                • Ruby/Rails image transformations
                • Ruby/Rails video transformations
                • Ruby/Rails asset management
                • CarrierWave integration
                • Attachinary integration
                • Active Storage integration
              • .NET SDK
                • .NET introduction
                • .NET quick start
                • .NET image and video upload
                • .NET image transformations
                • .NET video transformations
                • .NET asset management
              • Go SDK
                • Go introduction
                • Go quick start
                • Go image and video upload
                • Go media transformations
                • Go asset management
                • Go sample projects
                • Go video tutorials
                • Go SDK reference
              • Dart SDK
                • Dart introduction
                • Dart quick start
                • Dart image and video upload
                • Dart media transformations
                • Dart SDK reference
            • Frontend SDKs
              • React SDK
                • React introduction
                • React Starter Kit
                • React quick start
                • React image and video upload
                • React image transformations
                • React video transformations
                • React sample projects
                • React video tutorials
                • React SDK reference
                • Transformation Builder reference
              • Vue.js SDK
                • Vue.js introduction
                • Vue.js quick start
                • Vue.js image and video upload
                • Vue.js image transformations
                • Vue.js video transformations
                • Vue.js sample projects
                • Vue.js video tutorials
                • Vue.js SDK reference
                • Transformation Builder reference
              • Angular SDK
                • Angular introduction
                • Angular quick start
                • Angular image and video upload
                • Angular image transformations
                • Angular video transformations
                • Angular sample projects
                • Angular video tutorials
                • Angular SDK reference
                • Transformation Builder reference
              • JavaScript SDK
                • JavaScript introduction
                • JavaScript quick start
                • JavaScript image and video upload
                • JavaScript image transformations
                • JavaScript video transformations
                • JavaScript sample projects
                • JavaScript video tutorials
                • JavaScript SDK reference
                • Transformation Builder reference
              • Next.js SDK
                • Next.js introduction
                • Next.js Starter Kit
                • Next.js quick start
                • Next.js image and video upload
                • Next.js image transformations
                • Next.js video transformations
                • Next.js sample projects
                • Next.js video tutorials
              • jQuery SDK
                • jQuery introduction
                • jQuery image and video upload
                • jQuery image transformations
                • jQuery video transformations
              • React SDK (Legacy)
                • React introduction
                • React image and video upload
                • React image transformations
                • React video transformations
                • React migration guide
              • Vue.js SDK (Legacy)
                • Vue.js introduction
                • Vue.js image and video upload
                • Vue.js image transformations
                • Vue.js video transformations
                • Vue.js migration guide
              • Angular SDK (Legacy)
                • Angular introduction
                • Angular image and video upload
                • Angular image transformations
                • Angular video transformations
                • Angular migration guide
              • JavaScript SDK (Legacy)
                • JavaScript introduction
                • JavaScript image and video upload
                • JavaScript image transformations
                • JavaScript video transformations
                • JavaScript migration guide
            • Mobile SDKs
              • iOS SDK
                • iOS introduction
                • iOS quick start
                • iOS image and video upload
                • iOS image transformations
                • iOS video transformations
                • iOS video player
                • iOS sample projects
              • Android SDK
                • Android introduction
                • Android quick start
                • Android image and video upload
                • Android image transformations
                • Android video transformations
                • Android video player
                • Android sample projects
              • Flutter SDK
                • Flutter introduction
                • Flutter quick start
                • Flutter image and video upload
                • Flutter media transformations
                • Flutter video player
                • Flutter video tutorials
                • Dart-based cloudinary_url_gen package reference
                • Flutter SDK reference
              • React Native SDK
                • React Native introduction
                • React Native image and video upload
                • React Native image transformations
                • React Native video transformations
                • React Native video player
              • Kotlin SDK
                • Kotlin introduction
                • Kotlin media transformations
            • Community-developed libraries
              • Astro
              • Laravel
              • NuxtJS
              • Svelte
              • Gatsby
              • Netlify
              • Drupal
          • Release Notes
            • Latest: October 31, 2026
            • August 31, 2026
            • July 9, 2026
            • Previous releases
              • May 28, 2026
              • April 7, 2026
              • February 28, 2026
              • January 30, 2026
              • 2025
                • December 18, 2025
                • October 31, 2025
                • September 3, 2025
                • July 09, 2025
                • May 27, 2025
              • 2024
                • November 29, 2024
                • October 9, 2024
                • August 12, 2024
                • June 27, 2024
                • May 31, 2024
                • April 16, 2024
                • February 28, 2024
                • January 03, 2024
              • 2023
                • November 13, 2023
                • October 26, 2023
                • September 21, 2023
                • August 15, 2023
                • July 13, 2023
                • June 19, 2023
                • May 16, 2023
                • Apr 04, 2023
                • Feb 21, 2023
              • 2022
                • Dec 27, 2022

          JavaScript SDK image transformations

          Last updated: Aug-17-2026

          Overview

          After you or your users have uploaded image assets to Cloudinary, you can deliver them via dynamic URLs. You can include instructions in your dynamic URLs that tell Cloudinary to transform your assets using a set of transformation parameters. All transformations are performed automatically in the cloud and your transformed assets are automatically optimized before they are routed through a fast CDN to the end user for optimal user experience.

          For example, you can resize and crop, add overlay images, blur or pixelate faces, apply a large variety of special effects and filters, and apply settings to optimize your images and to deliver them responsively.

          The @cloudinary/url-gen package simplifies the generation of transformation URLs, and includes special components and directives for easy embedding of assets in your JavaScript application.

          If you haven't yet installed the JavaScript SDK, you might want to jump to the quick start first.

          See also: JavaScript video transformations

          On this page:

          • Overview
          • Image transformations with JavaScript
          • Syntax overview
          • Deliver and transform images
          • Sample app: JavaScript image transformations
          • Apply common image transformations
          • Plugins

          Image transformations with JavaScript

          To transform a media asset, use the @cloudinary/url-gen package to create the transformation, then set the src attribute of the image element to the URL of the transformed image to render the media on your site. For example:

          In the above example, the front_face image is cropped to a 150 x 150 pixel thumbnail with rounded corners, focusing on the face, resulting in this URL:

          Transformed face

          The @cloudinary/url-gen package installs an additional transformation-builder-sdk library as a dependency, which handles the transformation generation part of the URL.

          You can use the Transformation Builder reference to find all available transformations, syntax and examples.

          Alternative ways to apply transformations

          There are a couple of other ways to apply transformations to your images that you may prefer to use, for example if a new transformation is not yet supported by the SDK, or if you're more familiar with other SDKs. Note, however, that you won't benefit from your IDE's code completion feature for building the transformations in these ways.

          See also: Shortcuts and aliases for other ways to simplify the syntax.

          URL syntax

          You can add any transformation in URL syntax using the addTransformation method.

          For example:

          This can be used together with other actions and qualifiers in the usual way. It's useful if a new transformation is added but not yet available in the SDK, or if you're just more familiar with the URL syntax.

          Object syntax

          If you prefer the more concise syntax used for transformations in the Node.js SDK, you can use the transformationStringFromObject method to build the transformation, and add it to your image using addTransformation, importing only transformationStringFromObject instead of all the individual actions and qualifiers.

          For example:

          Note
          The required JavaScript import for this syntax is likely to be heavier than importing the actions and qualifiers separately.

          Syntax overview

          The @cloudinary/url-gen package provides an intuitive coding experience for transforming an asset:

          • The SDK supports an action-based syntax, designed to make building delivery URLs and transformations logical and discoverable.
          • It allows discovering the available options from within your development environment, and ensures that only options that are supported can be used together.

          The general form of the syntax is:

          JavaScript transformation general syntax

          An example being:

          JavaScript transformation structure

          Actions and ActionGroups

          • Assets expose methods called ActionGroups (myImage.adjust()) that represent a directive to Cloudinary on how to transform a specific aspect of an asset
          • ActionGroups receive an Action object as a parameter that defines the specific action to apply
          • Action objects are created through Factory methods (Adjust.replaceColor())
          • Some actions require a qualifier as a parameter (lightblue)
          • You can find more Actions in @cloudinary/url-gen/actions
          • You can import all actions with import {Actions} from '@cloudinary/url-gen'

          Qualifiers and QualifierValues

          • Actions expose methods to define their behaviors (tolerance())
          • We call the methods on Actions, Qualifiers
          • Qualifiers usually accept a QualifierValue (17 in tolerance(17))
          • QualifierValues can be primitive (numbers, strings) or predefined SDK values that can be imported
          • Many QualifierValues are functions
          • You can find more QualifierValues in @cloudinary/url-gen/qualifiers

          The output of each ActionGroup is a complete transformation component (separated by slashes) in the URL. For example, the syntax example above would generate the following URL:

          Transformed sample image

          Tree shaking

          The @cloudinary/url-gen package allows you to import only what you need, to minimize your bundle size.

          See the Transformation Builder reference for all actions and qualifiers.

          For example, if you import Effect, you import all effect actions, which may be more than you need. The only reason you may want to do this is to make other methods discoverable. Without tree shaking, actions require qualification (for example, Effect.outline()).

          • Without tree shaking:

            You can also use:

            In this case outline() is equivalent to Effect.outline().

          • With tree shaking:

          Similarly, for qualifier values:

          • Without tree shaking:

          • With tree shaking:

          Most of the examples shown in this guide use tree shaking.

          Shortcuts and aliases

          To simplify some of the syntax, you can use string shortcuts for nested qualifiers. For example, rather than:

          you can say:

          Additionally, there are aliases for delivery format and quality, to shorten the syntax further. For example, the above can be shortened to:

          For quality, instead of:

          you can say:

          Deliver and transform images

          The @cloudinary/url-gen package makes it easy for you to create image URLs including any transformation parameters.

          Direct URL building

          You can build an image URL by:

          1. Configuring your Cloudinary instance.
          2. Instantiating a CloudinaryImage object for the image you want to deliver, using cld.image().
          3. Calling the toURL() method of the CloudinaryImage object to return the delivery URL:

          The resulting URL, myURL, is:

          Sample image

          Specifying a version of your image to deliver

          You can specify a particular version of your image to deliver by using the setVersion method. The version is added to the delivery URL as explained in Asset versions.

          For example, to specify version 1610625835 of the sample image from the example above:

          The resulting URL is now:

          Specifying the delivery type

          You can change the delivery type from the default of upload to any of the other delivery types, using the setDeliveryType method.

          For example, to define a fetch URL:

          The resulting URL is:

          Transforming your image

          Images are transformed by adding serialized transformation instructions to the image delivery URL. For example, to scale your image to a width of 400 pixels, add c_scale,w_400.

          https://res.cloudinary.com/demo/image/upload/c_scale,w_400/bike.jpg

          Using the @cloudinary/url-gen package, you transform an image by performing one or more transformation actions on the CloudinaryImage object (see the syntax overview). Remember to import the actions that you are using:

          Tip
          Discover alternative ways to apply transformations to your images.

          Chaining transformations

          Cloudinary transformations can be chained together (each transformation is applied to the result of the previous transformation). For example, the following code crops the image to 150x150, rounds the corners, applies a sepia effect, adds text to the top center of the resized image, then rotates the entire result by 20 degrees and delivers a PNG.

          The code above generates the following image delivery URL:

          Transformed image

          Sample app: JavaScript image transformations

          In this JavaScript app, you can see all the transformations that are used throughout this guide. Each transformation example has its own JavaScript file showing the imports and syntax required.

          Here's the app in action:


          Fork the repo and try it yourself

          The code for this app is available in GitHub.

          • Enjoy interactive learning? Check out more sample apps!

          Apply common image transformations

          This section provides an overview and examples of how to implement the following commonly used image transformation features using the @cloudinary/url-gen package.

          • Resizing and cropping
          • Converting to another image format
          • Applying image effects and filters
          • Adding text and image overlays
          • Image optimizations

          Keep in mind that this section is only intended to introduce you to the basics of using image transformations.

          Tips
          • For comprehensive explanations of how to implement a wide variety of transformations, see Image transformations.
          • For a full list of all supported image transformations and their usage, see the Transformation URL API reference.

          Resizing and cropping

          There are a variety of different ways to resize and/or crop your images, and to control the area of the image that is preserved during a crop. The following example uses the fill cropping method to generate and deliver an image that completely fills the requested 250x250 size while retaining the original aspect ratio. It uses face detection gravity to ensure that all the faces in the image are retained and centered when the image is cropped:

          Original image before face recognition cropping Original image Fill cropping with 'faces' gravity Fill cropping with 'faces' gravity

          You can also use automatic gravity to determine what to keep in the crop automatically.

          Original image before automatic cropping Original image Fill cropping with 'auto' gravity Fill cropping with 'auto' gravity

          For details on all resizing and cropping options, see resizing and cropping images.

          Converting to another image format

          You can deliver any image uploaded to Cloudinary in essentially any image format. There are three main ways to convert and deliver in another format:

          • Specify the image's public ID with the desired extension.
          • Explicitly set the desired format using the format action type of the delivery action.
          • Use auto format to instruct Cloudinary to deliver the image in the most optimized format for each browser that requests it.

          For example:

          1. To deliver a .jpg file in .gif format:

          • Either add the .gif extension to the public ID when instantiating the CloudinaryImage:

            This is the returned URL:

          • Or use the delivery action, setting format to gif (note that myImage.format('gif'); is an alias for myImage.delivery(format('gif'));:

            This is the returned URL:

          2. To let Cloudinary select the optimal format for each browser, set format to auto. For example, in Chrome, this image may deliver in .avif or .webp format (depending on your product environment setup):

          This is the returned URL:

          For more details, see:

          • Delivering images in different formats
          • Automatic format selection (f_auto)
          • Tips and considerations for using f_auto

          Applying image effects and filters

          You can select from a large selection of image effects, enhancements, and filters to apply to your images. The available effects include a variety of color balance and level effects, tinting, blurring, pixelating, sharpening, automatic improvement effects, artistic filters, image and text overlays, distortion and shape changing effects, outlines, backgrounds, shadows, and more.

          For example, the code below applies a cartoonify effect, rounding corners effect, and background color effect (and then scales the image down to a height of 300 pixels).

          An image with several transformation effects

          For more details on the available image effects and filters, see Visual image effects and enhancements.

          Adding text and image overlays

          You can add images and text as overlays on your main image. You can apply the same types of transformations on your overlay images as you can with any image and you can use gravity settings or x and y coordinates to control the location of the overlays. You can also apply a variety of transformations on text, such as color, font, size, rotation, and more.

          For example, the code below overlays a couple's photo on a mug image. The overlay photo is cropped using face detection with adjusted color saturation and a vignette effect applied. The word love is added in a pink, fancy font and rotated to fit the design. A balloon graphic is also added. Additionally, the final image is cropped and the corners are rounded.

          Tip
          Although at first glance this example may look complicated, take the time to look through the code and you'll see it's actually quite intuitive!

          An image with many transformations and overlays applied

          Image optimizations

          By default, Cloudinary automatically performs certain optimizations on all transformed images. There are also a number of additional features that enable you to further optimize the images you use in your JavaScript application. These include optimizations to image quality, format, and size, among others.

          For example, you can use the auto qualifier for the fetch-format and quality attributes to automatically deliver the image in the format and quality that minimize file size while meeting the required quality level. Below, these two parameters are applied, resulting in a 50% file size reduction (1.4 MB vs. 784 KB) with no visible change in quality.

          50% file size optimization using auto format and auto quality features

          For an in-depth review of the many ways you can optimize your images, see Image optimization.

          Plugins

          The @cloudinary/html package from frontend-frameworks provides plugins to render the media on your site in the optimal way and improve your user's experience:

          • Lazy loading to delay loading images if they are not yet visible on the screen.
          • Responsive images to resize your images automatically based on the viewport size.
          • Image accessibility to make your images more accessible to your users with visual disabilities.
          • Image placeholders to display a lightweight version of an image while the target image is downloading.

          Both lazy loading and image placeholders are great techniques for helping to optimize your page load times and, in turn, improve your metrics related to Core Web Vitals.

          First, install the @cloudinary/html package:

          Then, use the required plugins in an HTMLImageLayer, for example, applying the responsive and accessibility plugins:

          The following sections explain each of the plugins in more detail, but you can also jump straight to a full example to start playing.

          Plugin order

          We recommend the following order when using our plugins to achieve the best results (omitting any you don't need):

          Lazy loading

          Lazy loading tells the browser not to download images that are not yet visible on the user's screen, and wait until the user scrolls to that image. This feature can potentially save bandwidth for images that are not actually viewed, and decrease the time needed to load a page.

          This video shows lazy loading in action. See how the GET request is triggered only when the image is starting to come into the viewport:

          To enable the lazy loading feature for a particular image, use the lazyload() plugin. This allows you to specify parameters that control when the image loads. For syntax details, see the reference.

          Example: Set root margin and threshold

          Load an image when 25% of it is visible. Specify a bounding box around the root element with margins, top: 10px, right: 20px, bottom: 10px, left: 30px:

          Note
          To avoid your page content 'jumping' as the elements dynamically adjust to add downloaded images, make sure to add height and width attributes to the img element.

          Responsive images

          You can make your images responsive, so that they automatically resize based on the viewport size. If the viewport is small, then a small image is requested, saving bytes and reducing page load times.

          This video shows responsive image behavior in action. See how a new image is requested when the browser is resized, based on the configured step size:

          To enable the responsive images feature for a particular image, use the responsive() plugin. You can specify either the step size or a set of image widths. For syntax details, see the reference.

          Example 1: Set step size

          Set the step size to 200 pixels:

          Example 2: Specify a set of image widths to use

          Specify a set of image widths (800, 1000 and 1400 pixels):

          Image accessibility

          This feature makes an image more accessible to users by specifying one of the following modes:

          Mode Transformation applied
          monochrome Reduces the image to use only one color.
          darkmode (default) Adds a dark tinting effect to the image.
          brightmode Adds a bright tinting effect to the image.
          colorblind Adds an effect to differentiate between colors that are similar.
          Monochrome image monochrome Dark mode image darkmode Bright mode image brightmode Colorblind assisted image colorblind

          To enable the accessibility feature for a particular image, use the accessibility() plugin. For syntax details, see the reference.

          Example: Apply an accessibility transformation

          Help color blind users by using the colorblind mode:

          Image placeholders

          An image placeholder is a lightweight version of a target image that can be downloaded quickly, and will occupy the same location as the intended target image, while the target image is still downloading. Once the target image download has been completed the placeholder is replaced with the final image. This feature is especially useful together with large images.

          Placeholder images offer the following features:

          • The page loads quickly without blank locations.
          • No page content 'jumping' as the elements dynamically adjust to add downloaded images.

          You can specify four different types of placeholder:

          Placeholder type Transformation for the placeholder image
          blur (default) A low quality, blurred version of the target image.
          pixelate A low quality, pixelated version of the target image.
          vectorize A low quality, vectorized version of the target image.
          predominant A solid, single color image - the predominant color in the target image.

          image placeholders

          To add a placeholder for a particular image, use the placeholder() plugin. For syntax details, see the reference.

          Example 1: Apply a placeholder transformation

          Use a blurred placeholder image while waiting for the full quality image to download:

          Example 2: Combine lazy loading with a placeholder

          You can also combine placeholder images with the lazy loading feature. In this case, when the user scrolls to the image location, the placeholder image is downloaded followed by the target image.

          For example, to use a solid, single-color placeholder image and the lazy loading feature:

          In this video, you can see all the different placeholder types combined with lazy loading:

          Sample app: JavaScript plugins

          See the plugins in action in this JavaScript app:


          Fork the repo and try it yourself

          The code for this app is available in GitHub.

          • Enjoy interactive learning? Check out more sample apps!

          ✔️ Feedback sent!

          ✖️  
          How helpful was this doc page?

          Thanks for submitting your rating. We got it!
          We'd love to hear more. Tell us what you liked and how we can make this page even better:

          *


          Cloudinary is committed to protecting your information security. For details, see our privacy policy.

          For additional assistance, open a support request.

          Error

          Unfortunately there's been an error sending your feedback.

          Rate this page:

          • JavaScript SDK image and video upload
          • JavaScript SDK video transformations
          You are visitor 01402503 — GeezerVison does not store the pages you look up.
          Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.