PHPackages                             beryllium/rawr - 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. beryllium/rawr

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

beryllium/rawr
==============

Image processing library for RAW/CR2 files, providing a wrapper for exiv2 and exiftool

1.1.0(9y ago)8952MITPHP

Since Feb 10Pushed 9y ago2 watchersCompare

[ Source](https://github.com/beryllium/rawr)[ Packagist](https://packagist.org/packages/beryllium/rawr)[ RSS](/packages/beryllium-rawr/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (1)Dependencies (1)Versions (4)Used By (0)

Rawr
====

[](#rawr)

**Rawr** is a PHP wrapper for the `exiv` and `exiftool` command-line utilities. It enables Preview Extraction, EXIF Data Examination, and EXIF Data Transfer to other image files.

In short: **Rawr** makes it easier to work with Canon CR2 (RAW) images from within PHP.

Installation Requirements
-------------------------

[](#installation-requirements)

- PHP 5.4+ or PHP 7
- A writeable temporary folder for performing operations
- System Binaries
    - **`exiv2`** to list and extract previews.
    - **`exiftool`** to transfer EXIF data between files.

Running the unit test suite requires both `exiv2` and `exiftool` present in your path. Testing EXIF data transfer requires the `php-exif` extension; these tests will be skipped if the extension is not found.

Adding Rawr To Your Project
---------------------------

[](#adding-rawr-to-your-project)

Require **Rawr** with Composer:

```
composer require beryllium/rawr

```

Then, in your code, instantiate **Rawr**:

```
$rawr = new Beryllium\Rawr\Rawr('path/to/sandbox', 'path/to/exiv2', 'path/to/exiftool');

```

(You can leave off the exiftool value if you are not interested in transferring Exif data.)

Why Do I Need Rawr?
-------------------

[](#why-do-i-need-rawr)

### Faster Thumbnails for RAW Photos

[](#faster-thumbnails-for-raw-photos)

Generating thumbnails from RAW photos in PHP is *very* slow. It's also clunky to wire up Imagick to get the proper output.

Each RAW photo actually has one or more built-in JPG previews stored alongside the camera's raw sensor data. Extracting this preview is a handy shortcut for avoiding PHP's slowness. Batch thumbnail operations are much faster with this approach.

**Rawr** can list previews:

```
$rawr->listPreviews('path/to/IMAGE.CR2')

```

The preview list is an array containing information about each preview. Typically, there is a full-size preview in addition to one or more smaller thumbnails.

The example output below demonstrates:

- **1**: 160x120 JPG
- **2**: 668x432 TIFF
- **3**: 5184x3456 JPG (the full-sized preview)

```
array(
    array(
        'index'  => 1,
        'type'   => 'image/jpeg',
        'height' => 120,
        'width'  => 160,
        'size'   => 14416,
    ),
    array(
        'index'  => 2,
        'type'   => 'image/tiff',
        'height' => 432,
        'width'  => 668,
        'size'   => 1731456,
    ),
    array(
        'index'  => 3,
        'type'   => 'image/jpeg',
        'height' => 3456,
        'width'  => 5184,
        'size'   => 1869241,
    ),
);

```

**Rawr** can extract individual previews:

```
// extracts the specified preview to the sandbox location and returns the resulting temporary filename
$previewFile = $rawr->extractPreview('path/to/IMAGE.CR2', 3)

```

You'll want to move the extracted `$previewFile` out of the sandbox if you want to preserve it. If you're just using it to generate thumbnails, you can leave it in the sandbox and locate the thumbnails elsewhere (and then unlink the `$previewFile` when you're done).

Don't forget to transfer Exif data to generated thumbnails!

### Preserving EXIF Data

[](#preserving-exif-data)

Every image taken with your digital camera has special data embedded in the file. This data records the time, camera settings, and even portrait/landscape settings for that image. With some newer cameras, the data can also include GPS coordinates.

Extracting the preview, or even generating a thumbnail from the extracted preview, can result in the loss of this data. Imagick and PHP do not seem to preserve it properly.

**Rawr** can transfer the EXIF data from the original CR2 file to a JPG:

```
// to any jpg file
$rawr->transferExifData('path/to/IMAGE.CR2', 'path/to/new_thumbnail.jpg');

// to the preview image you extracted
$rawr->transferExifData('path/to/IMAGE.CR2', $previewFile);

```

Keep in mind that transferring Exif data can be slow. Expect it to take one or two seconds per call, depending on server CPU/RAM/Disk speed.

**Rawr** can extract the EXIF data into a consumable format, allowing you to make decisions based on the data:

```
// translated format
$translatedData = $rawr->listExifData('path/to/IMAGE.CR2', Rawr::EXIF_TRANSLATED);

// raw format
$data = $rawr->listExifData('path/to/IMAGE.CR2');

```

The Past and Future of Rawr
---------------------------

[](#the-past-and-future-of-rawr)

I built **Rawr** as part of a home photography project. I needed to quickly generate thumbnails for 22,000 CR2 files. Doing it by rendering the RAW out to a JPG using ImageMagick could've taken years.

If the project helps you out, great! If you find issues with it, please contribute by either logging an issue or a PR on the project.

In the future, I would like to support a wider variety of RAW formats.

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% 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 ~130 days

Total

3

Last Release

3532d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/602491?v=4)[Kevin Boyd](/maintainers/beryllium)[@beryllium](https://github.com/beryllium)

---

Top Contributors

[![beryllium](https://avatars.githubusercontent.com/u/602491?v=4)](https://github.com/beryllium "beryllium (7 commits)")[![phpway](https://avatars.githubusercontent.com/u/10482389?v=4)](https://github.com/phpway "phpway (1 commits)")

---

Tags

photoexifexiftoolrawexiv2exivcr2rawr

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/beryllium-rawr/health.svg)

```
[![Health](https://phpackages.com/badges/beryllium-rawr/health.svg)](https://phpackages.com/packages/beryllium-rawr)
```

###  Alternatives

[fileeye/pel

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

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

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

2140.8k](/packages/joserick-png-metadata)[lychee-org/php-exif

Object-Oriented EXIF parsing

1186.0k1](/packages/lychee-org-php-exif)[alchemy/phpexiftool

Exiftool driver for PHP

40190.6k4](/packages/alchemy-phpexiftool)[frameright/image-metadata-parser

Image metadata parsing library

1135.1k](/packages/frameright-image-metadata-parser)[dantsu/php-image-editor

PHP library to easily edit image with GD extension.

33167.0k2](/packages/dantsu-php-image-editor)

PHPackages © 2026

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