Transformations
PichaX image transformations
GET https://api.pichax.dev/v1/generate/transformWelcome to the Image Transformations section of our API documentation. This page covers everything you need to know about modifying images on-the-fly using our simple and fast HTTP-based API.
Whether you want to resize, crop, rotate, blur, or convert formats, this section will guide you through the available transformation options, parameters, and usage examples. The transformations are designed to be chained via query parameters to give you powerful control over how your images are served.
Note: To perform transformations, you must include an identifier (
id), expiration (expiry) a valid API key (key), a signature (signature) and a publicly accessible source image URL (src) and parameters (params) describing the transformations.
Let’s dive into how to make your first transformation request and explore the features available.
Example:
// Example URL
https://api.pichax.dev/v1/generate/transform?id=identifier&expires=9999999999&key=px_test_mYEivWIXeAyrhmHQlJgyw1ORTGZtxDtrIpcxs8Tbys&signature=a03d665eaf291afcb9f23d431efef4dcfe70ccc55ab72737d4c753c95a671d06&src=https://images.pexels.com/photos/3671083/pexels-photo-3671083.jpeg&cache=false¶ms={"crop":{"w":1500,"h":2000, "mode": "centre"}, "flip": "horizontal","effects":[{"blur":40}] }
Extra request query parameters
These parameters are required to do any transformation
src
string
URL-encoded path to the source image
params
string
URL-encoded JSON describing the transformations
cache
boolean
Defines if the transformation should be cached or not - OPTIONAL Default: true
🛠️ Supported Transformations
Transformations are passed as a JSON object in the params query parameter.
Transformation Options
rotate
{"degrees" : 20} (int)
Rotates image by specified degrees
resize
{"scale": 0.5}
Scales image size proportionally
{"w": 100, "h": 200, "mode": "fill"}
resizes an image and fills the image Mode options: "fill", "crop", "fit"
{"w": 200}
Resizes an image, and keeps the height aspect ratio
crop
x, y, w, h (all int). x and y are optional and default to 0
Crops a region from the image
{"w": 100, "h": 200, "mode": "centre"}
Crops a region of an image Modes: "centre", "attention", "entropy" If mode is not provided, crop happens from top-left corner.
flip
"horizontal" or "vertical"
Flips the image
Applies effects to the image
watermark
{"text": "Testing"}
Adds a watermark on the bottom right of the image, This is only supported for Production key. Otherwise, it defaults to "PichaX"
Last updated