Download the PHP package phpmlkit/opal without Composer
On this page you can find all versions of the php package phpmlkit/opal. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download phpmlkit/opal
More information about phpmlkit/opal
Files in phpmlkit/opal
Download phpmlkit/opal
More information about phpmlkit/opal
Files in phpmlkit/opal
Please rate this library. Is it a good library?
Informations about the package opal
Opal
High-performance image processing for PHP, backed by libvips
Features
- Lazy Evaluation: All image operations are lazy and only executed when needed (saving, encoding, exporting)
- Immutable Operations: Every transformation returns a new image instance
- NDArray Integration: Seamless interoperability with
phpmlkit/ndarrayfor ML workflows - Comprehensive API: Support for all common image operations
- Type-Safe: Full PHP 8.2+ type safety with enums and value objects
- Memory Efficient: Zero-copy operations where possible
Performance
Load → resize → rotate 45° → sharpen (full pipeline):
| Image | GD | Imagick | Opal |
|---|---|---|---|
| 640×480 | 8.48 ms | 128.55 ms | 1.56 ms |
| 1920×1080 | 49.67 ms | 721.97 ms | 5.36 ms |
| 4000×2670 | 152.74 ms | 2,039.15 ms | 15.47 ms |
| 6000×4000 | 299.43 ms | 3,538.47 ms | 33.17 ms |
Apple M1, macOS. Run: php benchmarks/opal-vs-gd-vs-imagick.php
Installation
Quick Start
Core Concepts
Lazy Evaluation
All image operations are lazy - they build a pipeline that's only executed when you call a terminal operation:
Immutable Operations
Every transformation returns a new image instance:
Usage Examples
Basic Image Operations
Color Space Conversion
Color Adjustments
Filters and Effects
Drawing and Compositing
NDArray Interoperability
Advanced Options
API Reference
Value Objects
Color
Immutable RGBA color representation.
ImageSize
Immutable 2D size descriptor.
BoundingBox
Immutable axis-aligned bounding box.
Enums
ColorSpace: RGB, RGBA, BGR, BGRA, Grayscale, Lab, HSV, CMYKImageFormat: JPEG, PNG, WebP, TIFF, GIF, BMP, AVIF, HEIFKernel: Nearest, Linear, Cubic, Mitchell, Lanczos2, Lanczos3, Mks211, Mks213FlipDirection: Horizontal, Vertical, BothBandFormat: UChar, UInt16, Float, DoubleChannelFormat: HWC, CHW
Options Classes
LoadOptions
Control image loading behavior.
SaveOptions
Control image saving behavior.
Performance Tips
- Use lazy evaluation: Chain operations together before saving
- Use shrink-on-load: Load with
Image::thumbnail()orLoadOptions::withShrink()for large images - Choose appropriate interpolation: Use
Lanczosfor quality,Bilinearfor speed - Dispose explicitly: Call
dispose()when done with large images
Documentation
Development
Requirements
- PHP 8.2 or higher
- ext-ffi extension
License
MIT
Credits
- libvips — image processing engine
- jcupitt/vips — PHP FFI bindings for libvips
- phpmlkit/ndarray — numerical computing for ML workflows
All versions of opal with dependencies
PHP Build Version
Package Version
Requires
php Version
^8.2
ext-ffi Version *
codewithkyrian/platform-package-installer Version ^2.0
jcupitt/vips Version ^2.0
phpmlkit/ndarray Version ^2.0
ext-ffi Version *
codewithkyrian/platform-package-installer Version ^2.0
jcupitt/vips Version ^2.0
phpmlkit/ndarray Version ^2.0
The package phpmlkit/opal contains the following files
Loading the files please wait ...