Reference
Comprehensive reference for all image manipulation functions in BoxLang.
Complete alphabetical reference for all image manipulation Built-In Functions (BIFs).
Fluent Builder
The BoxLang Image Manipulation module provides a modern, fluent API through the BoxImage class. This chainable interface makes image manipulation code more readable and maintainable.
🔄 Quick Reference: BIF vs Fluent API
Here's how common BIF patterns translate to the modern Fluent API:
ImageNew("photo.jpg")
ImageNew("photo.jpg")
ImageResize(img, 800, 600)
img.resize(800, 600)
ImageScaleToFit(img, 400)
img.scaleToFit(400)
ImageCrop(img, 10, 10, 200, 200)
img.crop(10, 10, 200, 200)
ImageRotate(img, 90)
img.rotate(90)
ImageFlip(img, "horizontal")
img.flip("horizontal")
ImageSplitGrid(img, 4, 3)
img.splitGrid(4, 3)
ImageAddBorder(img, 5, "black")
img.addBorder(5, "black")
ImageSetDrawingColor(img, "red")
img.setDrawingColor("red")
ImageDrawText(img, "Hello", 10, 50)
img.drawText("Hello", 10, 50)
ImageBlur(img, 3)
img.blur(3)
ImageSharpen(img, 0.5)
img.sharpen(0.5)
ImageGrayScale(img)
img.grayScale()
ImageNegative(img)
img.negative()
ImageWrite(img, "output.jpg")
img.write("output.jpg")
ImageWriteBase64(img)
img.toBase64String()
ImageGetWidth(img)
img.getWidth()
ImageGetHeight(img)
img.getHeight()
Chaining Example
BIF Approach - Verbose and Procedural:
Fluent API - Concise and Chainable:
📋 Method Categories
🎨 Creation & Loading
Image()/ImageNew()- Create/load images from file, URL, base64, or create blank canvasImageReadBase64()- Load image from base64 string
✂️ Transformations
resize()- Resize to specific dimensionsscaleToFit()- Scale proportionally to fit within boundscrop()- Extract a rectangular regionrotate()- Rotate by angleflip()/transpose()- Flip horizontally/vertically/diagonally, or rotate in 90° incrementsshear()- Apply shear transformationsplitGrid()- Split image into a grid of tiles
🎨 Effects & Filters
blur()- Apply blur effectsharpen()- Sharpen the imagegrayScale()- Convert to grayscalenegative()- Create negativeoverlay()- Overlay another imagepaste()- Paste image at position
🖌️ Drawing
setDrawingColor()- Set drawing colorsetDrawingStroke()- Set stroke stylesetDrawingTransparency()- Set transparencysetAntiAliasing()- Enable/disable anti-aliasingsetBackgroundColor()- Set background colordrawText()- Draw textdrawLine()- Draw linedrawRect()- Draw rectangledrawRoundRect()- Draw rounded rectangledrawOval()- Draw oval/circledrawArc()- Draw arcdrawPoint()- Draw pointclearRect()- Clear rectangle area
🎀 Decorations
addBorder()- Add border around image
💾 Output
write()- Write to file (format auto-detected from extension)toBase64String()- Export as base64 string (format auto-detected, overridable)getBlob()- Get raw byte arraygetBufferedImage()- Get Java BufferedImage
ℹ️ Information
getWidth()- Get image widthgetHeight()- Get image heightinfo()- Get comprehensive image infogetExifMetadata()/getExifTag()- Read EXIF metadatagetIPTCMetadata()/getIPTCTag()- Read IPTC metadata
⚡ Utilities (BIF only)
ImageGenerateCaptcha()- Generate CAPTCHA images with configurable difficultyImageQRCodeGenerate()/ImageQRCodeRead()- Generate QR codes and read them backImageWriteToBrowser()- Stream image to HTTP responseGetReadableImageFormats()/GetWriteableImageFormats()- List supported formats (includes WebP, GIF, BMP, TIFF)
🚀 Complete Example
Here's a real-world example showing the power of method chaining:
Last updated
Was this helpful?
