bitandblack / image-information
Reading information of images
Requires
- php: >=7.2
- ext-dom: *
- bitandblack/iccprofile: ^0
- myclabs/php-enum: ^1.7
Requires (Dev)
- ext-imagick: *
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^8.0 || ^9.0
README
ImageInformation
Reading information of images:
- The size
- The color profile
Currently supported files and extensions:
.ai
Adobe Illustrator Artwork.bmp
Windows Bitmap.eps
Encapsulated PostScript.gif
Graphics Interchange Format.ico
Initial Coin Offering.iff
Interchange File Format.jp2
,.jpf
(Extended) JPEG 2000.jpg
,.jpeg
Joint Photographic Experts Group.pdf
Portable Document Format.png
Portable Network Graphics.psd
(Adobe) Photoshop Document.svg
Scalable Vector Graphics.tif
,.tiff
Tagged Image File Format.wbmp
Wireless Application Protocol Bitmap Format.webp
Google WebP
Installation
This package is made for the use with Composer. Add it to your project by running $ composer require bitandblack/image-information
.
Usage
Define your file with the File
class. Init the Image
class then and add your file:
<?php
use BitAndBlack\ImageInformation\Image;
use BitAndBlack\ImageInformation\Source\File;
$file = new File('MyFile.eps');
$image = new Image($file);
Access the images size: $image->getSize();
Access the images color profile: $image->getICCProfile();
Cache
You can speed up the image parsing by using the internal cache. When initialising a file, add it to a new cache object and init the image then with the cache object:
<?php
use BitAndBlack\ImageInformation\Cache\Cache;
use BitAndBlack\ImageInformation\Image;
use BitAndBlack\ImageInformation\Source\File;
$file = new File('MyFile.eps');
$cache = new Cache($file);
$image = new Image($cache);
To follow this example, the file MyFile.eps
would be cached in a file MyFile-eps.imagecache
.
Help
If you have questions feel free to contact us under hello@bitandblack.com
.
Thanks
Thanks to Marc Alexander for the work in marc1706/fast-image-size.