You are here: Web API Functions > getimage > crop

crop

The crop method scales the returned image to the natural level that best matches the dimensions of the requested bounding box. It differs from the fit method mainly in that the selected region will always be retained at the expense of the bounding box.

The crop method is the default.

The two examples below illustrate how results can differ with the crop method depending on how the bounding box and natural levels relate to each other.

NOTE: In both examples, the entire image has been specified as the selected region, though for simplification and clarity this is not shown in the code samples included here.

Example: 400 x 400 bounding box request using crop method

Request:

http://demo.lizardtech.com/lizardtech/iserv/getimage?cat=Geo&item=BLM_relief.sid&wid=400&hei=400&method=crop

Result:

In this example, the natural level closest to 400 x 400 has dimensions of 454 x 320. This region (the whole image) is returned in its entirety, which results in an image whose dimensions are larger than those of the bounding box.

If you want to ensure that the returned image fits inside of the requested bounds, use the cropinside method.

Example: 300 x 300 bounding box request using crop method

Request:

http://demo.lizardtech.com/lizardtech/iserv/getimage?cat=Geo&item=BLM_relief.sid&wid=300&hei=300&method=crop

Result:

In this second example, the closest natural level to the requested bounding box results in an image that's only 227 x 160, which is smaller than the requested 300 x 300 bounding box.