ImageAutoCrop
ImageAutoCrop (Statement)
Format
imageautocrop image
imageautocrop image, color
Description
Trims a uniform border away from an image held in memory, shrinking it to the smallest rectangle that contains the interesting content. The change is made to the image in place — image is the identifier returned by ImageNew, ImageLoad, or ImageCopy.
- With no color, the fully transparent edges of the image are removed.
- With a color (see Rgb), edges made entirely of that color are removed instead.
To crop to an exact rectangle rather than by content, use ImageCrop.
Example
a = imageload("scan.png")
imageautocrop a, rgb(255,255,255) # trim the white margins
print imagewidth(a) + " x " + imageheight(a)
See Also
ImageAutoCrop, ImageCentered, ImageCopy, ImageCrop, ImageDraw, ImageFlip, ImageHeight, ImageLoad, ImageNew, ImagePixel, ImageResize, ImageRotate, ImageSetPixel, ImageSmooth, ImageTransformed, ImageWidth, Unload
Availability
BASIC-256 2.0 and later. Documented from the BASIC-256 v2.1 continuation project.