PHPackages                             php-sdl/sdl3-image - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. php-sdl/sdl3-image

ActivePhp-ext[Image &amp; Media](/categories/media)

php-sdl/sdl3-image
==================

PHP extension for SDL3\_image — image loading (PNG, JPG, WebP, and more) built with Zephir

v0.2.0(1mo ago)02MITCPHP &gt;=8.2CI passing

Since Apr 17Pushed 1mo agoCompare

[ Source](https://github.com/php-sdl/sdl3-image)[ Packagist](https://packagist.org/packages/php-sdl/sdl3-image)[ RSS](/packages/php-sdl-sdl3-image/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependenciesVersions (2)Used By (0)

php-sdl3-image
==============

[](#php-sdl3-image)

[![CI](https://github.com/php-sdl/sdl3-image/actions/workflows/ci.yml/badge.svg)](https://github.com/php-sdl/sdl3-image/actions/workflows/ci.yml)[![PHP](https://camo.githubusercontent.com/c43902a50e55ff766fc179e27d9b9a292ef8fcadbdd4d855bb077a334e2f9b46/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d254532253839254135253230382e322d3737376262343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://www.php.net)[![SDL3](https://camo.githubusercontent.com/0d60227c13873647c269a604bb58bab7866996600408cd565817dcc32b4e3cd0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53444c332d254532253839254135253230332e342e302d316434656438)](https://www.libsdl.org/)[![SDL3_image](https://camo.githubusercontent.com/e5fd7f74046a7f3bf1d7a9ca42b76c33534af7a4f0eebb5fe9e237e5accc77ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53444c335f5f696d6167652d254532253839254135253230332e322d316434656438)](https://github.com/libsdl-org/SDL_image)[![Built with Zephir](https://camo.githubusercontent.com/8e72a9e9874ec036e66f84af12bd028857d1f200674b7acaa9eb97271a123f7c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6275696c74253230776974682d5a65706869722d666636613030)](https://zephir-lang.com/)[![Platform](https://camo.githubusercontent.com/37c663164df6eec24d0327668403be1782ab3245cf57963be37d9b6873a823a8/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f706c6174666f726d2d6c696e75782532302537432532306d61634f532d6c6967687467726579)](#requirements)[![License: MIT](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](#license)

> PHP extension for SDL3\_image — image loading built with [Zephir](https://zephir-lang.com/).

`sdl3image` wraps [SDL3\_image](https://github.com/libsdl-org/SDL_image) for PHP 8.2+, providing image decoding from common formats (PNG, JPG, WebP, and more) into `SDL_Surface` values, and texture loading into an existing `SDL_Renderer`.

Pair it with [php-sdl/sdl3](https://github.com/php-sdl/sdl3) for windowing, renderer creation, and event handling. Both extensions share the `Sdl3*`namespace prefix and can be loaded side-by-side.

---

Table of contents
-----------------

[](#table-of-contents)

- [Requirements](#requirements)
- [Installation](#installation)
    - [Via PHP PIE (recommended)](#via-php-pie-recommended)
    - [Platform installers](#platform-installers)
    - [Manual build with `phpize`](#manual-build-with-phpize)
- [Verifying the install](#verifying-the-install)
- [Quick start](#quick-start)
- [API reference](#api-reference)
- [Companion extension](#companion-extension)
- [License](#license)

---

Requirements
------------

[](#requirements)

ComponentMinimum versionNotesPHP8.2ZTS and NTS builds both supported.[php-sdl/sdl3](https://github.com/php-sdl/sdl3)any**Required for renderer usage.** Provides `SDL_Renderer` and other SDL3 runtime primitives.SDL33.4.0C library — must be discoverable via `pkg-config sdl3`.SDL3\_image3.2C library — must be discoverable via `pkg-config SDL3_image` (or `sdl3-image` / `sdl3_image`).OSLinux / macOSWindows is not currently supported.CompilerC11 toolchain`gcc`, `clang`, or Apple Clang.`php-dev` / `phpize`matches PHPRequired for any build path.Tested on macOS (Apple Silicon + Intel), Debian Trixie, Raspberry Pi OS (arm64 / armhf), and NVIDIA JetPack 6 (Jetson Orin).

---

Installation
------------

[](#installation)

### Via PHP PIE (recommended)

[](#via-php-pie-recommended)

Install [php-sdl/sdl3](https://github.com/php-sdl/sdl3) first, then install this extension:

```
pie install php-sdl/sdl3
pie install php-sdl/sdl3-image
```

PIE handles the full build pipeline (`phpize` → `configure` → `make` → `install`). Make sure SDL3 &gt;= 3.4.0 and SDL3\_image &gt;= 3.2 are already installed on the system before running.

### Platform installers

[](#platform-installers)

Three installer scripts live at the repository root. Each one installs SDL3 and SDL3\_image if needed, builds the extension with Zephir, and enables it for detected PHP SAPIs.

**macOS** (Homebrew):

```
bash install-macos.sh
```

**Debian Trixie / Raspberry Pi OS** (amd64, arm64, armhf):

```
bash install-debian-trixie.sh
```

**JetPack 6 / Ubuntu 22.04** (builds SDL3 + SDL3\_image from source):

```
bash install-jetpack6.sh
```

Each script writes build output to `./build.log` and prints concise diagnostics on failure.

### Manual build with `phpize`

[](#manual-build-with-phpize)

If generated C source exists in `ext/`, build without Zephir:

```
cd ext
phpize
./configure --enable-sdl3image
make -j"$(nproc 2>/dev/null || sysctl -n hw.logicalcpu)"
sudo make install
```

Then enable the extension:

```
; /etc/php/8.4/cli/conf.d/30-sdl3image.ini
extension=sdl3image.so
```

If SDL3 or SDL3\_image is installed in a non-standard prefix, export `PKG_CONFIG_PATH` before `./configure`.

---

Verifying the install
---------------------

[](#verifying-the-install)

One-liner sanity check:

```
php -m | grep sdl3image
```

Expected output:

```
sdl3image

```

---

Quick start
-----------

[](#quick-start)

```
