bitandblack/image-information

Reading information of images

1.4.0 2020-03-12 08:20 UTC

This package is auto-updated.

Last update: 2020-09-12 09:35:58 UTC


README

PHP from Packagist Codacy Badge Latest Stable Version Total Downloads License

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 image-information@bitandblack.com.

Thank

Thanks to Marc Alexander for the work in marc1706/fast-image-size.