nuggan

API Reference

Request Format

All requests use the following URL format:

/:routePrefix/:cropX/:cropY/:cropWidth/:cropHeight/:resizeWidth/:resizeHeight/:compressionLevel/:base64Ref

The service accepts both GET and HEAD requests.

Path Parameters

Image Reference Encoding

Strict Mode Disabled

If strict mode is disabled in your configuration, base64Ref can be any absolute URL encoded with Base64.

Example: Direct Base64 encoding of a public image URL.

Strict Mode Enabled

If strict mode is enabled, base64Ref must use the following format:

_{groupIndex}_{base64ImagePath}

Example: _2_L3BvcHRvY2F0X3YyLnBuZw==

Where:

For validation details, see the codec acceptances test.

Examples

All examples below use the default configuration with routePrefix = "optimg". They reference the Poptocat image from the third group in groupedBaseUrls.

The original image is first cropped (if parameters are specified), then resized (if parameters are specified).

Example #1: No-crop & no-resize (passthrough)

URL: ../0/0/-/-/-/-/-/_2_L3BvcHRvY2F0X3YyLnBuZw==

Result: Original image served as-is.

Example #1

Example #2: Crop only (origin X=110, Y=700)

URL: ../110/700/-/-/-/-/-/_2_L3BvcHRvY2F0X3YyLnBuZw==

Result: Cropped from (110, 700) to bottom-right corner.

Example #2

Example #3: Full crop (origin X=110, Y=700, width=190, height=190)

URL: ../110/700/190/190/-/-/-/_2_L3BvcHRvY2F0X3YyLnBuZw==

Result: 190×190 pixel crop starting at (110, 700).

Example #3

Example #4: Crop & resize (crop to 190×190, then resize width to 128)

URL: ../110/700/190/190/128/-/-/_2_L3BvcHRvY2F0X3YyLnBuZw==

Result: 190×190 crop, then resized to 128 pixels (width constrained).

Example #4

Example #5: Crop & full resize (crop to 190×190, resize to 128×96)

URL: ../110/700/190/190/128/96/-/_2_L3BvcHRvY2F0X3YyLnBuZw==

Result: 190×190 crop, then resized to 128×96 pixels.

Example #5

Example #6: Crop & full resize (crop to 190×190, resize to 128×512)

URL: ../110/700/190/190/128/512/-/_2_L3BvcHRvY2F0X3YyLnBuZw==

Result: 190×190 crop, then resized to 128×512 pixels.

Example #6

Example #7: Crop, resize & compress (compression level=9)

URL: ../110/700/190/190/128/512/9/_2_L3BvcHRvY2F0X3YyLnBuZw==

Result: 190×190 crop, resize to 128×512, compressed with level 9 (best compression). File size reduced from 12.5K to 11.96K.

Example #7

Configuration Setup

For detailed configuration instructions and parameter explanations, see the Usage Guide.