Skip to content

Commit

Permalink
Merge pull request #33 from mike42/feature/17-read-gif
Browse files Browse the repository at this point in the history
Implement GIF reader
  • Loading branch information
mike42 authored Feb 17, 2019
2 parents 3ac1be9 + 5967bd8 commit 0fcbc54
Show file tree
Hide file tree
Showing 107 changed files with 1,551 additions and 79 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ php:
- 7.0
- 7.1
- 7.2
- 7.3
- nightly
- hhvm-nightly

Expand Down
72 changes: 37 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,60 +9,62 @@ processing extensions (Gd, Imagick) are not required.

This allows developers to eliminate some portability issues from their applications.

## Requirements
### Features

- Format support includes PNG, GIF, BMP and the Netpbm formats (See docs: [File formats](https://gfx-php.readthedocs.io/en/latest/user/formats.html)).
- Support for scaling, cropping, format conversion and colorspace transformations (See docs: [Image operations](https://gfx-php.readthedocs.io/en/latest/user/operations.html)).
- Pure PHP: This library does not require Gd, ImageMagick or GraphicsMagick extensions.

## Quick start

### Requirements

- PHP 7.0 or newer.
- zlib extension, for reading PNG files.
- `zlib` extension, for reading PNG files.

## Get started
### Installation

- Have a read of the documentation at [gfx-php.readthedocs.io](https://gfx-php.readthedocs.io/)
- See the `examples/` sub-folder for snippets.
Install `gfx-php` with composer:

## Status & scope
```bash
composer install mike42/gfx-php
```

Currently, we are implementing basic raster operations on select file formats.
### Basic usage

See related documentation for:
The basic usage is like this:

- [Available input file formats](https://gfx-php.readthedocs.io/en/latest/user/formats.html#input-formats).
- [Available output file formats](https://gfx-php.readthedocs.io/en/latest/user/formats.html#output-formats).
- [Available image operations](https://gfx-php.readthedocs.io/en/latest/user/operations.html).
```php
<?php
use Mike42\GfxPhp\Image;
$img = Image::fromFile("colorwheel256.png");
$img -> write("test.gif");
```

If you're interested in image processing algorithms, then please consider contributing an implementation.
### Further reading

For algorithms, it appears feasable to implement:
- Read of the documentation at [gfx-php.readthedocs.io](https://gfx-php.readthedocs.io/)
- See the `examples/` sub-folder for snippets.

- Rotate
- Layered operations
- Affine transformations
- Lines, arcs, circles, and rectangles.
## Contributing

And sill on the roadmap for format support:
This project is open to all kinds of contributions, including suggestions, documentation fixes, examples, formats and image processing algorithms.

- BMP input, which involves RLE decompression (BMP output is already available).
- GIF input, which involves LZW decompression (GIF output is already available).
- TIFF input and output, which also involves LZW (de)compression.
Some ideas for improvement listed in [the issue tracker](https://travis-ci.org/mike42/gfx-php). Code contributions must be releasable under the LGPLv3 or later.

In the interests of getting the basic features working first, there is no current plan to attempt lossy compression, or formats that are not common on either the web or for printing, eg:
### Scope

- JPEG
- MNG
- PAM format
- XPM
- .. etc.
As a small project, we can't do everything. In particular, `gfx-php` is not likely to ever perform non-raster operations:

Also, as we don't have the luxury of pulling in dependencies, I'm considering anything that is not a raster operation out-of-scope:
- vector image formats (PDF, SVG, EPS, etc).
- anything involving vector fonts

- All vector image formats (PDF, SVG, EPS, etc).
- Anything involving vector fonts
### Acknowledgements

### Test data sets
This repository uses test files from other projects:

- [imagetestsuite](https://code.google.com/archive/p/imagetestsuite/)
- [bmpsuite](http://entropymine.com/jason/bmpsuite/)
- [pngsuite](http://www.schaik.com/pngsuite/)
- [jburkardt's data sets](https://people.sc.fsu.edu/~jburkardt/data/)
- [PyGIF](https://github.com/robert-ancell/pygif) test suite by Robert Ancell.
- [pngsuite](http://www.schaik.com/pngsuite/) by Willem van Schaik.

## Similar projects

Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,16 @@
"php": "7.0.0"
}
},
"require": {},
"require": {
"php": ">=7.0.0"
},
"autoload": {
"psr-4": {
"Mike42\\": "src/Mike42"
}
},
"require-dev": {
"phpunit/phpunit": "^6.5",
"squizlabs/php_codesniffer": "^3.2"
"squizlabs/php_codesniffer": "^3.3.1"
}
}
Loading

0 comments on commit 0fcbc54

Please sign in to comment.