PHPackages                             nguyenhiep/pdf2image - 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. nguyenhiep/pdf2image

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

nguyenhiep/pdf2image
====================

Allow you cropping an image from file pdf

014PHPCI failing

Since Dec 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/nguyenhiepvan/pdf2image)[ Packagist](https://packagist.org/packages/nguyenhiep/pdf2image)[ RSS](/packages/nguyenhiep-pdf2image/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Convert a pdf to an image
=========================

[](#convert-a-pdf-to-an-image)

This package provides an easy to work with class to cropping an image from pdf file

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

[](#requirements)

You should have [Imagick](http://php.net/manual/en/imagick.setresolution.php) and [Ghostscript](http://www.ghostscript.com/) installed. See [issues regarding Ghostscript](https://github.com/nguyenhiepvan/pdf2image#issues-regarding-ghostscript).

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

[](#installation)

The package can be installed via composer:

```
composer require nguyenhiep/pdf2image:dev-master
```

Usage
-----

[](#usage)

```
use Nguyenhiep\Pdf2image\Pdf2image;

$instance = new Pdf2image();

$instance->cropImage($pdf,$page,$width, $height, $startX, $startY);
```

the output will be saved in public/images.

Issues regarding Ghostscript
----------------------------

[](#issues-regarding-ghostscript)

This package uses Ghostscript through Imagick. For this to work Ghostscripts `gs` command should be accessible from the PHP process. For the PHP CLI process (e.g. Laravel's asynchronous jobs, commands, etc...) this is usually already the case.

However for PHP on FPM (e.g. when running this package "in the browser") you might run into the following problem:

`Uncaught ImagickException: FailedToExecuteCommand 'gs'`This can be fixed by adding the following line at the end of your `php-fpm.conf` file and restarting PHP FPM. If you're unsure where the `php-fpm.conf` file is located you can check `phpinfo()`. If you are using Laravel Valet the `php-fpm.conf` file will be located in the `/usr/local/etc/php/YOUR-PHP-VERSION` directory.

`env[PATH] = /usr/local/bin:/usr/bin:/bin`This will instruct PHP FPM to look for the `gs` binary in the right places.

Security
--------

[](#security)

If you discover any security related issues, please email [Mr. Hiep Nguyen](mailto:nguyenhiepvan.bka@gmail.com?subject=%5BGitHub%5D%20Problem%20with%20pdf2image) instead of using the issue tracker.

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/5ee7ece29e66e7029d6b12d947a7d9714ae36346f21e92d767cfc797b86949d8?d=identicon)[nguyenhiepvan](/maintainers/nguyenhiepvan)

---

Top Contributors

[![nguyenhiepvan](https://avatars.githubusercontent.com/u/33170716?v=4)](https://github.com/nguyenhiepvan "nguyenhiepvan (12 commits)")

### Embed Badge

![Health badge](/badges/nguyenhiep-pdf2image/health.svg)

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

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

135931.0k3](/packages/goat1000-svggraph)[stefangabos/zebra_image

A single-file, lightweight PHP library designed for efficient image manipulation featuring methods for modifying images and applying filters

138121.6k7](/packages/stefangabos-zebra-image)[treinetic/imageartist

ImageArtist is a php gd Wrapper which makes Image manipulation insanely easy, we introduce ImageArtist as Photoshop for php

8783.2k](/packages/treinetic-imageartist)[johncarter/filament-focal-point-picker

An image focal point picker for Filament Admin.

4431.7k1](/packages/johncarter-filament-focal-point-picker)[yk/laravel-ocr

A wrapper for gocr.

1356.6k](/packages/yk-laravel-ocr)

PHPackages © 2026

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