Get inspired at ContentCon. Learn more and register today
Get inspired at ContentCon. Learn more and register today
Contentstack.comAcademyLogin
CS-log-dark.svgCS-log-dark.svg
  • Changelog
  • APIs
  • SDKs

Platform

  • Solution Center
  • Marketplace
  • Changelog
  • Developers & IT
  • Business users
  • Digital leaders
  • Developer Fast Track
  • Plans & Pricing

Solutions

  • Retail
  • Travel and tourism
  • Financial services
  • Technology
  • Manufacturing
  • E-commerce
  • Localization
  • Personalization
  • Portals and knowledge bases

Resources

  • Academy
  • Docs
  • Product updates
  • Contentstack on Contentstack
  • Blog
  • Insights and analyst reports
  • Webinars
  • Podcasts
  • Glossary
  • Content generative library
  • Community
  • Headless CMS
  • Composable AXP
  • Personalization
  • CDP

Customers

  • Case Studies
  • Customer Care
  • Contentstack Experience Awards
  • Customer support

Partners

  • Overview
  • Find a partner
  • Login

Company

  • About us
  • News
  • Customer support portal
  • Contact

Social

  • Facebook
  • LinkedIn
  • Instagram
  • GitHub
  • YouTube
  • Discord
  • X
LegalTermsPrivacyTrust Center

Cookie settings

Copyright © 2026 Contentstack Inc. All rights reserved.
/
  1. Home
  2. APIs
  3. Image Delivery API
  4. Pad

Pad

markdownView as Markdown

This parameter lets you add extra pixels to the edges of an image. This is useful if you want to add whitespace or border to an image. The value for this parameter can be given in pixels or percentage. 

You can specify values for top, right, bottom, and left padding for an image. For example, to add padding to the top edge by 25px, right edge by 50px, bottom edge by 75px and left edge by 100, use the query ?pad=25,50,75,100.

You can also combine two or more values. For example, to add padding to the top edge by 25px, right edge by 50px, bottom edge by 75px and left edge by 50px, use the query ?pad=25,50,75. Similarly, to give padding to the top and bottom edge by 50px, and right and left by 100, use ?pad=50,100. To provide padding on all edges, use ?pad=50.

It is important to note that by default the pad parameter applies white background. If the given image contains transparent background, and the output image also has transparency, then transparent padding will be applied. 

Add padding

GEThttps://images.contentstack.io/v3/assets/{stack_api_key}/{asset_uid}/{file_uid}/filename.jpg?environment={environment_name}&pad={top_value},{right_value},{bottom_value},{left_value}

Note Check out the limitations that are applicable here.

To add a colored border, you need to use the bg-color parameter along with pad. For example, to add a red border, use the query ?pad=10&bg-color=FF0000. Also, note that if the canvas and pad parameters are used together, the pad parameter will be ignored.

Click to enlarge

Add padding and background color

GEThttps://images.contentstack.io/v3/assets/{stack_api_key}/{asset_uid}/{file_uid}/filename.jpg?environment={environment_name}&pad={top_value},{right_value},{bottom_value},{left_value}&bg-color={value}

Note Check out the limitations that are applicable here.

Additional Notes
  1. By default, this parameter applies padding in white color.
  2. If the given image contains transparent background and the output image also has transparency, then transparent padding will be applied.
  3. CSS style shorthand values are also acceptable.
  4. If the pad and the canvas parameters are used together in the same request, the pad parameter will be ignored.
Hide Parameters

Query Parameters

padoptionalstring

Enter value for top, left, bottom and right edges for which padding needs to be applied

Example:

25,50,75,100
environmentrequiredstring

Enter the environment scoped to your delivery token.

Example:

production
Hide Parameters

Query Parameters

padoptionalstring

Enter the values for top, left, bottom and right edges for which padding needs to be applied. 

Example:

25,50,75,100
bg-coloroptionalstring

Enter the values for background color for padding. 

Example:

FF0000
environmentrequiredstring

Enter the environment scoped to your delivery token.

Example:

production