Skip to main content

VIUCraft Documentation

JavaScript SDK - Image Transformations

On This Page

The ImageBuilder class provides a chainable API for building image transformation URLs.

Typescript
const url = client.image('img-uuid')
  .resize(800, 600)
  .grayscale()
  .quality(80)
  .setFormat('webp')
  .toURL();

Available Operations

    1. resize(width, height, scale?) - Resize image
    2. crop(left, top, width, height) - Crop region
    3. rotate(angle, background?) - Rotate image
    4. brightness(factor) - Adjust brightness (0-10)
    5. contrast(factor) - Adjust contrast (0-10)
    6. grayscale() - Convert to grayscale
    7. invert() - Invert colors
    8. blur(sigma?) - Gaussian blur (0.01-100)
    9. sharpen(sigma?) - Sharpen (0.01-100)
    10. emboss() - Emboss effect
    11. median(size?) - Median filter (odd integer 1-99)
    12. thumbnail(width, height, crop?) - Create thumbnail
    13. smartCrop(width, height) - Auto-crop to interesting region
    14. flip(direction) - Flip horizontal/vertical
    15. quality(value) - Output quality (1-100)
    16. setFormat(format) - Output format (jpg/png/webp)
    17. useShort(enabled?) - Use short URL format

All parameters are validated before URL is built. Invalid values throw ViucraftValidationError.

Was this helpful?

On This Page