Skip to main content
GET
/
transform
Transform
curl --request GET \
  --url https://api.visionfly.ai/transform \
  --header 'X-API-KEY: <api-key>'
{
  "success": false,
  "error": "",
  "public_url": "https://cdn.visionfly.ai",
  "size": 0,
  "content_type": "image/webp"
}

Transform Image

The transform endpoint allows you to perform various image transformations and optimizations. You can resize, adjust quality, apply filters, and convert image formats.

Endpoint

GET /transform/

Parameters

ParameterTypeRequiredDescriptionDefaultRange
srcstringYesVisionFly CDN URL--
wintegerNoWidth in pixels12801-4200
hintegerNoHeight in pixels7201-4200
qintegerNoQuality (1-100)801-100
fstringNoOutput formatautoauto, webp, avif, jpeg, jpg, png
blurnumberNoGaussian blur strength00-100
sharpnumberNoSharpen strength00-100
briintegerNoBrightness adjustment0-100 to 100
conintegerNoContrast adjustment0-100 to 100
satintegerNoSaturation adjustment0-100 to 100
hueintegerNoHue rotation00-360
gammanumberNoGamma adjustment2.21.0-3.0

Example Request

curl -X GET "https://api.visionfly.ai/transform?src=https://cdn.visionfly.ai/<user_id>/example.jpg&w=800&h=600&q=90&f=webp&bri=10&con=5"

Example Response

{
  "success": true,
  "error": "",
  "public_url": "https://cdn.visionfly.ai/<user_id>/example&w=800&h=600&q=90&f=webp&bri=10&con=5.webp",
  "size": 302.5,
  "content_type": "image/webp"
}

Error Responses

400 Bad Request

{
  "type": "request_error",
  "msg": "Incorrect URL parameters",
  "status_code": 400
}

422 Unprocessable Entity

{
  "type": "image_processing_error",
  "msg": "Invalid width parameter provided",
  "status_code": 422
}

Use Cases

  • Image resizing and optimization
  • Format conversion
  • Image enhancement
  • Applying filters and effects
  • Creating thumbnails
  • Optimizing images for web delivery

Best Practices

  • Always use HTTPS URLs for the source image
  • Optimize image quality based on use case
  • Use appropriate image formats (WebP for modern browsers)
  • Consider implementing caching for transformed images
  • Monitor image transformation performance

Authorizations

X-API-KEY
string
header
required

Query Parameters

src
string
required

VisionFly CDN url

w
integer
default:1280

Width in pixels

Required range: x <= 4200
h
integer
default:720

Height in pixels

Required range: x <= 4200
q
integer
default:80

Quality (1-100)

Required range: 1 <= x <= 100
f
enum<string>
default:auto

Output format

Available options:
auto,
webp,
avif,
jpeg,
jpg,
png
blur
number
default:0

Gaussian blur strength (0-100)

Required range: 0 <= x <= 100
sharp
number
default:0

Sharpen strength (0-100)

Required range: 0 <= x <= 100
bri
integer
default:0

Brightness adjustment (-100 to 100)

Required range: -100 <= x <= 100
con
integer
default:0

Contrast adjustment (-100 to 100)

Required range: -100 <= x <= 100
sat
integer
default:0

Saturation adjustment (-100 to 100)

Required range: -100 <= x <= 100
hue
integer
default:0

Hue rotation (0-360)

Required range: 0 <= x <= 360
gamma
number
default:2.2

Gamma adjustment (1.0-3.0)

Required range: 1 <= x <= 3

Response

Successful Response

Response model for image transformation operations.

Contains information about the success/failure of the transformation and details about the transformed image.

success
boolean
default:false

Indicates whether the transformation was successful

error
string
default:""

Error message if the transformation failed

Examples:

"Invalid input image"

"Unsupported format"

public_url
string<uri>
default:https://cdn.visionfly.ai

Public URL of the transformed image

Required string length: 1 - 2083
Example:

"https://cdn.visionfly.ai/images/transformed_image.webp"

size
number
default:0

Size of the transformed image in bytes

Required range: x >= 0
Example:

302.5

content_type
string
default:image/webp

MIME type of the transformed image

Examples:

"image/webp"

"image/jpeg"