https://github.com/joseluisq/gimage
A PHP library for easy image handling. 🖼
https://github.com/joseluisq/gimage
crop gd image jpg jpg2png php-library png rendering resize save scale shapes
Last synced: 6 months ago
JSON representation
A PHP library for easy image handling. 🖼
- Host: GitHub
- URL: https://github.com/joseluisq/gimage
- Owner: joseluisq
- License: mit
- Created: 2015-11-15T04:47:48.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2022-10-26T18:01:17.000Z (almost 3 years ago)
- Last Synced: 2025-03-23T14:11:11.149Z (7 months ago)
- Topics: crop, gd, image, jpg, jpg2png, php-library, png, rendering, resize, save, scale, shapes
- Language: PHP
- Homepage: https://joseluisq.github.io/gimage/
- Size: 2.33 MB
- Stars: 152
- Watchers: 11
- Forks: 11
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
# GImage
[](https://github.com/joseluisq/gimage/actions/workflows/devel.yml) [](https://packagist.org/packages/joseluisq/gimage) [](//packagist.org/packages/joseluisq/gimage) [](https://packagist.org/packages/joseluisq/gimage) [](https://packagist.org/packages/joseluisq/gimage)
> A PHP library for easy image handling. 🖼
__GImage__ is a simple and small library based on [PHP Image Processing and GD](http://php.net/manual/en/book.image.php) for processing images easily.

_Presentation card built with GImage - [View code example](https://joseluisq.github.io/gimage/examples/creating-a-presentation-card/)_
## Features
- Load an image from a local path, URL or image resource.
- Create shapes such as rectangles or ellipses with opacity.
- Resize, scale or crop images proportionally.
- Rotate images, shapes or texts.
- Embed text with custom TTF fonts.
- Compose a pool of images with `Canvas`.
- Swap image formats such as JPEG, PNG or GIF.
- Save images locally or output them on the browser.
- Save several copies of the same image.
- Render an image in memory and return its resource.## Requirements
GImage requires PHP [`7.4`](https://www.php.net/releases/7_4_0.php) or a recent PHP version with the latest [GD Extension](http://php.net/manual/en/book.image.php).
## Install
```sh
composer require joseluisq/gimage
```## Usage
Load an external PNG image and save it as JPG:
```php
load($url)
// Scale to 50% (300x99)
->scale(0.5)
// Change the format to JPG
->toJPG()
// Saving in local path
->save('arch.jpg');
```See [GImage Website](https://bit.ly/gimage-php) for detailed usage instructions and more advanced examples.
## Changelog
Check out the [CHANGELOG.md](./CHANGELOG.md) file.
## Examples
See [code examples](./examples) directory.
## Development
### Run tests
Via [Composer](https://getcomposer.org/)
```sh
composer install
composer run-script test
```Via [Docker](https://www.docker.com/) (multi PHP versions test)
```sh
make docker-tests
```## Contribution
Feel free to send some [Pull request](https://github.com/joseluisq/gimage/pulls) or file an [issue](https://github.com/joseluisq/gimage/issues).
## License
This work is primarily distributed under the terms of the [MIT license](LICENSE-MIT).
©2015-present [Jose Quintana](https://joseluisq.net)