https://github.com/thestaticturtle/php-gpf
PHP extension for decoding the PGF image
https://github.com/thestaticturtle/php-gpf
image pgf php-extension php8
Last synced: about 1 year ago
JSON representation
PHP extension for decoding the PGF image
- Host: GitHub
- URL: https://github.com/thestaticturtle/php-gpf
- Owner: TheStaticTurtle
- License: mit
- Created: 2024-04-25T20:27:29.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-29T12:55:01.000Z (almost 2 years ago)
- Last Synced: 2025-04-01T15:53:37.679Z (about 1 year ago)
- Topics: image, pgf, php-extension, php8
- Language: C++
- Homepage:
- Size: 1.57 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# PHP-PGF
This repository is a PHP extension for decoding the [PGF](https://en.wikipedia.org/wiki/Progressive_Graphics_File) image format to either their raw bitmap form or directly re-encoded to PNG for ease of use.
The main goal of this library was to provide a simple way of fetching the thumbnails from a shared [digiKam](https://en.wikipedia.org/wiki/Digikam) database directly from said database instead of re-generating them.
As of now only these function used for decode are implemented:
- `pgf_decode_to_rgba(string $pgfData, int $level = 0): string`
- `pgf_decode_to_png(string $pgfData, int $level = 0): string`
As this extension was written purely for decoding images, I am not planing to implement the encode functions for now, if someone wants to, PRs are appreciated!
This extension depends on:
- [libpgf](https://github.com/TheStaticTurtle/libpgf) (tested with `7.21.7`)
- [lodepng](https://github.com/lvandeve/lodepng) (tested with `ed3c5f1`)
Some checks were done to ensure that it wil not crash everything if an invalid use case is detected but please note that while libpgf does use c++ excpetions that are catchable it also contains calls to `assert` which will crash the php executable if reached.
The library has been successfully tested to decode digiKam thumbnails with:
- `PHP-8.2-Win32-TS`
- `PHP-8.1-Win32-NTS`
- `PHP-8.3-Win32-NTS`
Linux build has not been tested!