DocumentationTransform Image

Transform Image

Send a GET request to this endpoint to transform an existing image with various options.

ℹ️

You will need to authenticate to use this API. See authentication.

ℹ️

This endpoint consumes 1 credit per successful image transformation.

Request

GET https://api.ojo.so/v1/transform/{options}/{sourceUrl}

Parameters

ParameterTypeDescription
optionsstringComma-separated list of transformation options
sourceUrlstringURL-encoded source image URL to transform

Available Transformation Options

OptionFormatDescriptionExample
ww-(pixels)Set output widthw-800
hh-(pixels)Set output heighth-600
mwmw-(pixels)Set maximum widthmw-1200
mhmh-(pixels)Set maximum heightmh-800
minwminw-(pixels)Set minimum widthminw-400
minhminh-(pixels)Set minimum heightminh-300
arar-(ratio)Set aspect ratio (width:height)ar-16:9
fitfit-(mode)Fit mode (cover/contain/fill/inside/outside)fit-cover
fmtfmt-(format)Output format (jpeg/png/webp/avif)fmt-webp
qq-(0-100)Quality settingq-80
progprog-(bool)Enable progressive encodingprog-true
losslesslossless-(bool)Enable lossless compressionlossless-true
cropcrop-(mode)Crop mode (entropy/attention/center)crop-entropy
fxfx-(float)Focal point X coordinatefx-0.5
fyfy-(float)Focal point Y coordinatefy-0.5
bribri-(-100,100)Adjust brightnessbri-10
concon-(-100,100)Adjust contrastcon-15
satsat-(-100,100)Adjust saturationsat-20
huehue-(-360,360)Adjust huehue-90
grayblur-(bool)Apply grayscalegray-true
gmgm-(float)Adjust gammagm-2.2
blurblur-(float)Apply blur effectblur-3.5
sharpensharpen-(bool)Apply sharpeningsharpen-true
rotrot-(degrees)Rotate imagerot-90
flipflip-(bool)Flip image verticallyflip-true
flopflop-(bool)Flip image horizontallyflop-true
bgbg-(hex color,mean)Set provided or mean of provided image color as background colorbg-ffffff
metameta-(bool)Preserve metadatameta-true
stripstrip-(bool)Strip metadatastrip-true
dprdpr-(float)Device pixel ratiodpr-2
autoauto-(options)Automatic optimizations (format/compress/enhance)auto-format|compress
curl --request GET \
  --url 'https://api.ojo.so/v1/transform/w-800,h-600,fmt-webp,q-80/https%3A%2F%2Fexample.com%2Fimage.jpg' \
  --header 'Authorization: Bearer <API Key>'

Response

The transformed image is returned directly in the response body with the appropriate Content-Type header.

Caching

By default, the transformed images are served with Cache-Control: public, max-age=86400 (1 day).

Examples

Here are some common transformation examples:

Resize to specific dimensions

/transform/w-800,h-600/https://example.com/image.jpg

Convert to WebP with quality setting

/transform/fmt-webp,q-80/https://example.com/image.jpg

Crop and resize maintaining aspect ratio

/transform/w-800,h-600,fit-cover,crop-entropy/https://example.com/image.jpg

Optimize for web delivery

/transform/auto-format|compress,w-800/https://example.com/image.jpg

Apply image adjustments

/transform/bri-10,con-15,sat-20,hue-30,sharpen-true/https://example.com/image.jpg

Responsive image with DPR

/transform/w-800,dpr-2,auto-format/https://example.com/image.jpg