PHPackages                             ycs77/image-metadata - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. ycs77/image-metadata

ActiveLibrary[Image &amp; Media](/categories/media)

ycs77/image-metadata
====================

The image metadata Library. Support panorama image.

v0.2.1(1y ago)054↓100%MITPHPPHP &gt;=8.2

Since Nov 29Pushed 1y agoCompare

[ Source](https://github.com/ycs77/php-image-metadata)[ Packagist](https://packagist.org/packages/ycs77/image-metadata)[ RSS](/packages/ycs77-image-metadata/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

Image Metadata (PHP 5.5+)
=========================

[](#image-metadata-php-55)

[![Latest Version on Packagist](https://camo.githubusercontent.com/de0b10f66139b60ef9977a0492fee787c83dfb2af40573fd18cd583f9a6a4cab/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f79637337372f696d6167652d6d657461646174613f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ycs77/image-metadata)[![Total Downloads](https://camo.githubusercontent.com/64aab875dff76643b0a39b504d5b9220e578ce36e546d80b3e15b09b4b080a5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f79637337372f696d6167652d6d657461646174613f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ycs77/image-metadata)[![Software License](https://camo.githubusercontent.com/c090e080484e2a2bc766446291d04437db823929042bf614b26a1643660ddf6f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e3f7374796c653d666c61742d737175617265)](LICENSE.md)

> Adapted from [dchesterton/image](https://packagist.org/packages/dchesterton/image). Support panorama image.

The image metadata Library. Support panorama image.

Warning: This library is pre-alpha and much of it is a WIP or simply not working at all. Proceed at your own risk.
------------------------------------------------------------------------------------------------------------------

[](#warning-this-library-is-pre-alpha-and-much-of-it-is-a-wip-or-simply-not-working-at-all-proceed-at-your-own-risk)

Supported image types:

- JPEG
- PNG
- GIF
- PDF
- SVG
- WEBP
- TIFF
- DNG
- RAW FORMATS- CR2, NEF, etc.

Supported image meta types:

- XMP
- IPTC
- EXIF

### Get metadata

[](#get-metadata)

```
$image = Image::fromFile($filename);

$headline = $image->getXmp()->getHeadline();
$camera = $image->getExif()->getCamera();
...
```

### Modify existing metadata

[](#modify-existing-metadata)

```
$image = Image::fromFile($filename);

$xmp = $image->getXmp();
$xmp->setHeadline('A test headline');
$xmp->setCaption('Caption');

$image->getIptc()->setCategory('Category');

$image->save();
```

### Standalone XMP

[](#standalone-xmp)

#### Generating standalone XMP

[](#generating-standalone-xmp)

```
$xmp = new Xmp;
$xmp->setHeadline('A headline')
...

$data = $xmp->getXml();
```

#### Modifying standalone XMP

[](#modifying-standalone-xmp)

```
$xmp = new Xmp($data); // or Xmp::fromFile($filename)
$xmp->setHeadline('A headline');

$data = $xmp->getXml();
```

### Setting/replacing XMP in image

[](#settingreplacing-xmp-in-image)

```
$xmp = new Xmp;
$xmp->setHeadline('A headline');
...

$image = Image::fromFile($filename);
$image->setXmp($xmp);

$image->save() // or $image->getBytes()
```

### Loading specific image type

[](#loading-specific-image-type)

When file type is known, you can load the file type directly using the file types' `fromFile` method.

```
$jpeg = JPEG::fromFile('image.jpg');
$png = PNG::fromFile('image.png');
```

### Instantiate from bytes

[](#instantiate-from-bytes)

If you don't have a file to work with but you do have the image stored in a string (from database, ImageMagick etc.) you can easily instantiate an object from the string.

```
$data = ...

$jpeg = JPEG::fromString($data);
$jpeg->getXmp()->setHeadline('Test headline');

$jpeg->save('out.jpg'); // or $jpeg->getBytes();
```

### Instantiate from GD or a stream

[](#instantiate-from-gd-or-a-stream)

You can also create an object from a GD resource or a stream.

```
$gd = imagecreate(100, 100);
$jpeg = JPEG::fromResource($gd);
```

```
$stream = fopen('...', 'r+');
$jpeg = JPEG::fromStream($stream);
```

### Aggregate metadata

[](#aggregate-metadata)

When just want a piece of metadata and don't care whether it's from XMP, IPTC or EXIF, you can use the aggregate meta object.

```
$image = Image::fromFile($filename);
$headline = $image->getAggregate()->getHeadline();
```

By default it checks XMP first, then IPTC, then EXIF but you can change the priority:

```
$aggregate = $image->getAggregate();
$aggregate->setPriority(['exif', 'iptc', 'xmp']);

$aggregate->getHeadline(); // will now check EXIF first, then IPTC, then XMP
```

You can also exclude a metadata type if you do not want to use it:

```
$aggregate->setPriority(['iptc', 'xmp']);
$aggregate->getHeadline(); // will only check IPTC and XMP
```

You can also modify metadata on an aggregate level:

```
$image = Image::fromFile($filename);
$image->getAggregate()->setHeadline('Headline');

$image->save();
```

This would set the headline in both XMP and IPTC. For maximum compatibility with other software it's recommended to use the aggregate metadata object where available.

#### Get GPS data

[](#get-gps-data)

```
$image = ...
$gps = $image->getAggregateMeta()->getGPS(); // checks EXIF and XMP
// or $gps = $image->getExif()->getGPS();

$lat = $gps->getLatitude();
```

### Set Panorama Image XMP Metadata

[](#set-panorama-image-xmp-metadata)

```
use Ycs77\ImageMetadata\Image;
use Ycs77\ImageMetadata\Metadata\Panorama\GPano;

$image = Image::fromFile($filename);
$image->getXmp()->setPanorama(function (GPano $gPano) {
    return $gPano
        ->projectionType()
        ->usePanoramaViewer(true)
        ->croppedAreaImageWidthPixels(8192)
        ->croppedAreaImageHeightPixels(4096)
        ->fullPanoWidthPixels(8192)
        ->fullPanoHeightPixels(4096)
        ->croppedAreaLeftPixels(0)
        ->croppedAreaTopPixels(0)
        ->stitchingSoftware('Your App Name');
});
$image->save();
```

More GPano metadata see [Photo Sphere XMP Metadata](https://developers.google.com/streetview/spherical-metadata).

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~322 days

Total

5

Last Release

697d ago

PHP version history (4 changes)v0.1.0PHP ^5.5

v0.1.1PHP ^5.5|^7.0

v0.1.2PHP &gt;=5.5

v0.2.0PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/a5a1e0caa0c50990d8ffc70d4a095706a4e2b71bd6a0f08860744f773c6f99a9?d=identicon)[ycs77](/maintainers/ycs77)

---

Top Contributors

[![ycs77](https://avatars.githubusercontent.com/u/38133356?v=4)](https://github.com/ycs77 "ycs77 (16 commits)")

---

Tags

imagemetadataphotoexifIPTCxmp

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ycs77-image-metadata/health.svg)

```
[![Health](https://phpackages.com/badges/ycs77-image-metadata/health.svg)](https://phpackages.com/packages/ycs77-image-metadata)
```

###  Alternatives

[frameright/image-metadata-parser

Image metadata parsing library

1133.9k](/packages/frameright-image-metadata-parser)[fileeye/pel

PHP Exif Library. A library for reading and writing Exif headers in JPEG and TIFF images using PHP.

197.1M2](/packages/fileeye-pel)[joserick/png-metadata

A PHP library for extract the metadata (XMP, EXIF) within a PNG format image.

2234.7k](/packages/joserick-png-metadata)[causal/extractor

This extension detects and extracts metadata (EXIF / IPTC / XMP / ...) from potentially thousand different file types (such as MS Word/Powerpoint/Excel documents, PDF and images) and bring them automatically and natively to TYPO3 when uploading assets. Works with built-in PHP functions but takes advantage of Apache Tika and other external tools for enhanced metadata extraction.

16244.5k](/packages/causal-extractor)[dantsu/php-image-editor

PHP library to easily edit image with GD extension.

34152.1k2](/packages/dantsu-php-image-editor)[lychee-org/php-exif

Object-Oriented EXIF parsing

1085.0k1](/packages/lychee-org-php-exif)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
