Utilities
Learn how to perform image transformations such as resizing, rotating, cropping, flipping, shearing, and translating images using BoxLang.
Image properties, format support, validation functions, and color reference.
Table of Contents
Image Properties
Get Image Dimensions
img = ImageNew("photo.jpg");
// Get width and height
width = img.getWidth(); // Member function
height = img.getHeight(); // Member function
// BIF syntax
width = ImageGetWidth(img);
height = ImageGetHeight(img);
writeln("Image is #width# x #height# pixels");Check Image Type
Get Comprehensive Info
Format Support
Get Readable Formats
Get Writeable Formats
Check Format Support
Supported Formats Reference
BMP
✅
✅
Bitmap, no compression
GIF
✅
✅
Supports transparency, animation
JPEG
✅
✅
Lossy compression, no transparency
PNG
✅
✅
Lossless, supports transparency
TIFF
✅
✅
High quality, large files
WBMP
✅
✅
Wireless bitmap, monochrome
Notes:
PNG - Best for web, supports transparency
JPEG - Best for photos, smaller file size
GIF - Best for animations, limited colors
TIFF - Best for archival, printing
BMP - Uncompressed, large files
Validation Functions
IsImage()
Check if a variable contains an image object:
IsImageFile()
Check if a file is a valid image without loading it:
Validation Examples
Color Reference
Named Colors
The module supports these named colors:
Available Named Colors:
black
#000000
white
#FFFFFF
red
#FF0000
green
#00FF00
blue
#0000FF
cyan
#00FFFF
magenta
#FF00FF
yellow
#FFFF00
orange
#FFA500
pink
#FFC0CB
gray
#808080
darkgray
#A9A9A9
lightgray
#D3D3D3
Hex Colors
Color Format Examples
Image Information
ImageInfo() Structure
Color Model Types
Binary Operations
Get Image as Byte Array
Get Java BufferedImage
Base64 Encoding
Utility Functions Reference
GetReadableImageFormats()
List readable formats
["BMP", "GIF", ...]
GetWriteableImageFormats()
List writable formats
["BMP", "GIF", ...]
ImageGetWidth(img)
Get width in pixels
1920
ImageGetHeight(img)
Get height in pixels
1080
ImageInfo(img)
Get full image info
{width: 1920, ...}
ImageGetBlob(img)
Get byte array
[binary data]
ImageGetBufferedImage(img)
Get Java BufferedImage
Java object
IsImage(var)
Check if variable is image
true/false
IsImageFile(path)
Check if file is image
true/false
Complete Utility Examples
Image File Browser
Format Converter
Image Validator
Batch Format Detection
Next Steps
Getting Started - Basic image operations
Advanced Examples - Real-world use cases
BIF Reference - Complete function reference
Last updated
Was this helpful?
