Pierre Joye has initiated discussion on an RFC for ext/gd 2.4 targeting PHP 8.6, proposing comprehensive modernization of the image extension while maintaining backward compatibility.
The proposal addresses three major areas:
Codec Synchronization and Enhancement. The bundled libgd has diverged significantly from upstream. The RFC aligns them by running every codec against its upstream compliance corpus, fixing color matching issues and FreeType bounding box/baseline problems for angled text. New codecs supported: QOI, JPEG XL, and UltraHDR. Existing codecs gain missing functionality: GIF animation read/write, multi-page TIFF support, full WebP animation, PNG option exposure, JPEG reader/writer options, and raw metadata read/write (EXIF, XMP, ICC, IPTC). A separate libgd sync PR (php/php-src#22532) containing most codec updates has already merged into php-src.
Object-Oriented API. New Gd\* OOP surface adds directly to GdImage as methods (scale(), rotate(), transform(), composeFrom(), saveTo(), etc.) while every existing procedural function maintains its current signature unchanged. Legacy code works freely alongside new methods since both operate on the same GdImage object. Each codec follows a consistent pattern: Codec::fromFile/fromString/fromStream and toFile/toString/toStream methods, immutable Info objects, and ReadOptions/WriteOptions value objects designed for future extensibility without breaking changes. Animation and multi-page formats get streaming Reader/Writer classes to avoid loading entire images into memory.
2D Vector and Canvas Layer. Built atop FreeType's rasterizer, this layer provides gradients, the complete Cairo compositing operator set (with correct unbounded operator and premultiplied alpha semantics), and save/restore state stacks. It draws directly into existing truecolor GdImage buffers with no copying, allowing interleaving with legacy drawing calls on the same image.
The RFC frames the uniform facade pattern and value object design as foundational for future roadmap items: planned internal image formats for PHP 2.5/3.x (true 32-bit ARGB, floating-point HDR buffers) will slot into the same interface rather than forcing parallel APIs. The fluent, chainable method style is designed so future streaming/pipeline modes can add a single entry method feeding the same chain, not a separate API.
Implementation is nearly complete at https://github.com/pierrejoye/php-src-syncgd. Joye plans to add a quantization method exposing mode selection (nnquant, legacy) and will create a formal PR before the discussion deadline. The discussion period runs 14 days until 2026-08-01.