Transformations

PichaX image transformations

GET https://app.pichax.dev/api/v1/generate/transform

Welcome 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.

Note: that the id ,expiry, key and signature parameters are used for authentication. They are discussed in detail in the Authentication section

Let’s dive into how to make your first transformation request and explore the features available.

Example:

// Example URL
GET https://app.pichax.dev/api/v1/generate/transform/
  ?id=identifier
  &expires=9999999999
  &key=ia_test_E8YpG6gb4OYWgiRf83HrsGBf36xn3Kgh2TINeSri5M
  &signature=17596a29c0272d1f4a5fef30c145b6f44ae10d631c640aaabe340d11d00d79bf
  &src=https%3A%2F%2Fmarketing.ke%2Fwp-content%2Fuploads%2F2024%2F10%2Fimage-1.png
  &params={"rotate":{"degrees":90},"resize":{"scale":0.5},"crop":{"x":100,"y":200,"w":400,"h":500},"flip":{"direction":"horizontal"}}

Extra request query parameters

These parameters are required to do any transformation

Parameter
Type
Description

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.

{
  "rotate": { "degrees": 90 },
  "resize": { "scale": 0.5 },
  "crop": { "x": 100, "y": 200, "w": 400, "h": 500 },
  "flip": { "direction": "horizontal" },
  "grayscale": true
}

Transformation Options

Transformation
Parameters
Description

rotate

degrees (int)

Rotates image by specified degrees

resize

scale (float)

Scales image size proportionally

crop

x, y, w, h (all int). x and y are optional and default to 0 also you can use type - "frontal_face"

Crops a region from the image When type is used, PichaX uses AI to detect a frontal looking face and crops it.

flip

direction (horizontal | vertical)

Flips the image

grayscale

true (boolean)

Converts an image to grayscale

Last updated