- Media API
- Transformations
- Resize
- pad
pad
The pad transformation adds uniform or custom padding around an image with a specified background color. Perfect for creating borders, adding whitespace for design layouts, or preparing images for social media.
Serving Content via CDN
The Media API is a CDN-based service that serves transformed images via GET requests. When you request a transformed image URL, the transformation is applied dynamically on the first request and then cached for subsequent requests.
URL Pattern
https://media.vyso.io/pad:size=SIZE:color=COLOR/ASSET_ID.jpgExamples
Simple Padding (10px all sides)
curl -i GET https://media.vyso.io/pad:size=10/ASSET_ID.jpgStandard Padding (20px)
curl -i GET https://media.vyso.io/pad:size=20:color=ffffff/ASSET_ID.jpgLarge Padding with Color
curl -i GET https://media.vyso.io/pad:size=50:color=000000/ASSET_ID.jpgCustom Sides (different padding)
curl -i GET https://media.vyso.io/pad:left=10:right=10:top=20:bottom=20:color=cccccc/ASSET_ID.jpgLarge Border Padding
curl -i GET https://media.vyso.io/pad:size=100:color=2563eb/ASSET_ID.jpgOn the first request, you'll receive a X-Cache: MISS header while the transformation is applied and cached. Subsequent requests will return X-Cache: HIT.
Parameters
sizeOPTIONALUniform padding on all sides in pixels. Accepted values:
- Range: 1 to 1000+
10- Small padding20- Standard padding50- Large padding- Applied to all sides unless overridden by specific parameters
leftOPTIONALLeft padding in pixels (overrides size).
rightOPTIONALRight padding in pixels (overrides size).
topOPTIONALTop padding in pixels (overrides size).
bottomOPTIONALBottom padding in pixels (overrides size).
colorOPTIONALPadding background color (hex format without #). Accepted values:
ffffff- White000000- Blackcccccc- Light gray- Defaults to white if not specified
Response
The API returns the image with padding added. The response format depends on the format of the asset stored in the Vyso asset cloud.
Content-Type: Determined by the stored asset format (e.g., image/jpeg, image/png)