Service Endpoint

https://edge.sandcage.com/<YOUR REAL-TIME PROCESSING ENDPOINT KEY>/0.2/resize


Request Parameters

url*
requiredThe relative or absolute URL path of the source image.
To mask the absolute path of a given source file an origin mapping can be assigned to the Realtime API Key.
width

integer

1...20000

conditionalThe width of the resulting image.
height

integer

1...20000

conditionalThe height of the resulting image.
ratio

decimal

0.01...

conditionalThe percent-wise dimensions of the resulting resized image relative to the dimensions of the source image.
If a value has been provided for either "width" or "height", the value provided for this parameter will not be taken into account.
If the calculated width or height are less than 1 pixel, then that dimension will be capped to 1 pixel.
fit
optionalA boolean representation of whether or not the resulting image should fit within the specified width and height.
This flag will only take affect if both "width" and "height" have been specified.
If the "width" and "height" are both specified without the "fit" parameter being set to "true" and the set values for "width" and "height" do not respect the aspect ratio of the image, then the produced image will be skewed.
Available options:
  • true
  • false

Default is false.
compress
optionalA boolean representation of whether or not the resulting image should be compressed.
Available options:
  • true
  • false

Default is false.
format
optionalWhether or not the file format of the resulting image should be converted to one that will produce a file with smaller file size. The returned image file format will depend on the support of the client software (e.g. browser). If omitted or set to false, then the returned image file format will be the same as the source image.
Available options:
  • auto
  • false

Default is false.
progressive
optionalA boolean representation of whether or not the file is encoded in a format that allows for progressively higher detail to be decoded prior to the complete image being delivered. Some browser limitation apply (see here). If "compress" is omitted or set to "false" it will be overrided and set to "true".
Only available for JPEGs.
Available options:
  • true
  • false

Default is false.
optimize
optionalA boolean representation of whether the engine will attempt to optimize the Huffman coding tables. If "compress" is omitted or set to "false" it will be overrided and set to "true".
Only available for JPEGs.
Available options:
  • true
  • false

Default is false.

Ratio-Based Resize Example Request

This request will resize the source image to 50%, while maintaining the aspect ratio.

https://edge.sandcage.com/18e102bea84860764a07dca77adbf145157751b7/0.2/resize?url=p%2Fa%2Fimg%2Fothers%2Fbefore.jpg&ratio=50

Result


Width-Based Resize Example Request

This request will produce an image with width 300 pixels.

https://edge.sandcage.com/18e102bea84860764a07dca77adbf145157751b7/0.2/resize?url=p%2Fa%2Fimg%2Fothers%2Fbefore.jpg&width=300

Result


Resize with Fit Example Request

In this request, since the "fit" parameter has been set to "true", the service will return an image with width 300 pixels and height 200 pixels, even though the height was set to 400 pixels.

https://edge.sandcage.com/18e102bea84860764a07dca77adbf145157751b7/0.2/resize?url=p%2Fa%2Fimg%2Fothers%2Fbefore.jpg&width=300&height=400&fit=true

Result


Height-Based Resize with Compression Enabled Example Request

This request will produce an image with height 200 pixels and compress the image.

https://edge.sandcage.com/18e102bea84860764a07dca77adbf145157751b7/0.2/resize?url=p%2Fa%2Fimg%2Fothers%2Fbefore.jpg&height=200&compress=true

Result


Width-Based Resize with Auto-Format Enabled Example Request

This request will produce an image with width 300 pixels and choose the most suitable file format.

https://edge.sandcage.com/18e102bea84860764a07dca77adbf145157751b7/0.2/resize?url=p%2Fa%2Fimg%2Fothers%2Fbefore.jpg&width=300&format=auto

Result


Ratio-Based Resize with Compression and Auto-Format Enabled Example Request

This request will resize the source image to 50%, compress the image and choose the most suitable file format.

https://edge.sandcage.com/18e102bea84860764a07dca77adbf145157751b7/0.2/resize?url=p%2Fa%2Fimg%2Fothers%2Fbefore.jpg&ratio=50&format=auto&compress=true

Result


Give it a try

You can adjust the options below to produce the respective parameters and see the resulting image.

100%
768px
512px
https://edge.sandcage.com/18e102bea84860764a07dca77adbf145157751b7/0.2/resize?url=p%2Fa%2Fimg%2Fothers%2Fbefore.jpg&width=768&height=512

Result


Still Have Questions?

We're always happy to help with code and integrations. Talk to us!