PHPackages                             viterbit/pdfimages-extractor - 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. viterbit/pdfimages-extractor

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

viterbit/pdfimages-extractor
============================

Extract images from pdf

v0.2.1(1y ago)253.6k↑87.8%MITPHPPHP ^7.3|^8.0

Since Sep 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/viterbit/pdfimages-extractor)[ Packagist](https://packagist.org/packages/viterbit/pdfimages-extractor)[ Docs](https://github.com/viterbit/pdfimages-extractor)[ RSS](/packages/viterbit-pdfimages-extractor/feed)WikiDiscussions master Synced 1mo ago

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

Extract images from a pdf
=========================

[](#extract-images-from-a-pdf)

This package provides a class to extract images from a pdf.

```
use Viterbit\PdfImagesExtractor\Pdf;

$images = Pdf::getImages('book.pdf'); //returns a FilesystemIterator
```

Requirements
------------

[](#requirements)

Behind the scenes this package leverages [pdfimages](https://en.wikipedia.org/wiki/Pdfimages). You can verify if the binary installed on your system by issuing this command:

```
which pdfimages
```

If it is installed it will return the path to the binary.

To install the binary you can use this command on Ubuntu or Debian:

```
apt-get install poppler-utils
```

On a mac you can install the binary using brew

```
brew install poppler
```

If you're on RedHat or CentOS use this:

```
yum install poppler-utils
```

Installation
------------

[](#installation)

You can install the package via composer:

```
composer viterbit/pdfimages-extractor
```

Usage
-----

[](#usage)

Getting images from a pdf is easy.

```
$images = (new Pdf())
    ->setPdf('book.pdf')
    ->images();
```

Or easier:

```
$images = Pdf::getImages('book.pdf');
```

By default the package will assume that the `pdftoimages` command is located at `/usr/bin/pdftoimages`. If it is located elsewhere pass its binary path to constructor

```
$images = (new Pdf('/custom/path/to/pdftoimages'))
    ->setPdf('book.pdf')
    ->images();
```

or as the second parameter to the `getImages` static method:

```
echo Pdf::getText('book.pdf', '/custom/path/to/pdftoimages');
```

Sometimes you may want to use [pdfimages options](https://linux.die.net/man/1/pdfimages). To do so you can set them up using the `setOptions` method.

```
$images = (new Pdf())
    ->setPdf('book.pdf')
    ->setOptions(['j', 'f 1'])
    ->images()
;
```

or as the third parameter to the `getImages` static method:

```
$images = Pdf::getImages('book.pdf', null, ['j', 'f 1']);
```

Please note that successive calls to `setOptions()` will overwrite options passed in during previous calls.

If you need to make multiple calls to add options (for example if you need to pass in default options when creating the `Pdf` object from a container, and then add context-specific options elsewhere), you can use the `addOptions()` method:

```
$images = (new Pdf())
    ->setPdf('book.pdf')
    ->addOptions(['f 1'])
    ->images()
;
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information about what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker. design agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance34

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 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 ~531 days

Total

3

Last Release

637d ago

### Community

Maintainers

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

---

Top Contributors

[![markitosgv](https://avatars.githubusercontent.com/u/1706470?v=4)](https://github.com/markitosgv "markitosgv (9 commits)")

---

Tags

extractorpdfimagesviterbit

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/viterbit-pdfimages-extractor/health.svg)

```
[![Health](https://phpackages.com/badges/viterbit-pdfimages-extractor/health.svg)](https://phpackages.com/packages/viterbit-pdfimages-extractor)
```

###  Alternatives

[spatie/image

Manipulate images with an expressive API

1.4k54.4M138](/packages/spatie-image)[ps/image-optimizer

Image optimization / compression library. This library is able to optimize png, jpg and gif files in very easy and handy way. It uses optipng, pngquant, pngcrush, pngout, gifsicle, jpegoptim and jpegtran tools.

9341.7M25](/packages/ps-image-optimizer)[brianmcdo/image-palette

Extracts colors from an image and generates a color palette against a whitelist of colors.

179209.0k2](/packages/brianmcdo-image-palette)[orbitale/imagemagick-php

A system that allows creating commands to send to the exec() function to use ImageMagick's powerful features.

43385.7k1](/packages/orbitale-imagemagick-php)[spatie/pixelmatch-php

Compare images using PHP

5783.7k9](/packages/spatie-pixelmatch-php)[audero/audero-wav-extractor

Audero Wav Extractor is a PHP library that allows to extract a chunk from a wav file. The extracted chunk can be saved on the hard disk, can be forced to be prompted as download by the user's browser or returned as a string for a later processing.

111.4k](/packages/audero-audero-wav-extractor)

PHPackages © 2026

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