morph

The morph transformation applies morphological operations (erosion, dilation, opening, closing) to enhance image structure. These operations are fundamental in image processing for removing noise, connecting components, or separating overlapping objects.

Serving Content via CDN

The Media API is a CDN-based service that serves transformed images via GET requests. When you request a transformed image URL, the transformation is applied dynamically on the first request and then cached for subsequent requests.

URL Pattern

https://media.vyso.io/morph:operation=OP:radius=RADIUS/ASSET_ID.jpg

Examples

Erode Operation

curl -i GET https://media.vyso.io/morph:operation=erode:radius=2/ASSET_ID.jpg

Dilate Operation

curl -i GET https://media.vyso.io/morph:operation=dilate:radius=2/ASSET_ID.jpg

Open Operation (Erode then Dilate)

curl -i GET https://media.vyso.io/morph:operation=open:radius=3/ASSET_ID.jpg

Close Operation (Dilate then Erode)

curl -i GET https://media.vyso.io/morph:operation=close:radius=3/ASSET_ID.jpg

On the first request, you'll receive a X-Cache: MISS header while the transformation is applied and cached. Subsequent requests will return X-Cache: HIT.

Parameters

operationREQUIRED

Morphological operation to apply. Accepted values:

  • erode - Erosion (shrinks white regions)
  • dilate - Dilation (expands white regions)
  • open - Opening (erode then dilate; removes small noise)
  • close - Closing (dilate then erode; fills small holes)
radiusREQUIRED

Kernel radius for the operation in pixels. Accepted values:

  • Range: 1.0 to 20.0+
  • 2.0 - Small kernel
  • 5.0 - Standard kernel
  • 10.0 - Large kernel for aggressive morphing
  • Larger radius affects more pixels per operation

Response

The API returns the morphologically transformed image. The response format depends on the format of the asset stored in the Vyso asset cloud.

Content-Type: Determined by the stored asset format (e.g., image/jpeg, image/png)