PHPackages                             splitbrain/slika - 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. splitbrain/slika

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

splitbrain/slika
================

Simple image resizing

1.0.8(2mo ago)51.8k↓50%3[2 issues](https://github.com/splitbrain/slika/issues)MITPHPPHP &gt;=7.0CI passing

Since May 1Pushed 2mo ago1 watchersCompare

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

READMEChangelogDependencies (2)Versions (11)Used By (0)

Slika - simple image handling for PHP
=====================================

[](#slika---simple-image-handling-for-php)

This is a library that covers only the bare basics you need when handling images:

- resizing
- cropping
- rotation

It can use either PHP's libGD or a locally installed ImageMagick binary.

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

[](#installation)

Use composer

```
composer require splitbrain/slika

```

Usage
-----

[](#usage)

Simply get an Adapter from the Slika factory, run some operations on it and call `save`.

Operations can be chained together. Consider the chain to be one command. Do not reuse the adapter returned by `run()`, it is a single use object. All operations can potentially throw a `\splitbrain\slika\Exception`.

Options (see below) can be passed as a second parameter to the `run` factory.

```
use \splitbrain\slika\Slika;
use \splitbrain\slika\Exception;

$options = [
    'quality' => 75
];

try {
    Slika::run('input.png', $options)
        ->resize(500,500)
        ->rotate(Slika::ROTATE_CCW
        ->save('output.jpg', 'jpg');
} catch (Exception $e) {
    // conversion went wrong, handle it
}
```

Please also check the [API Docs](https://splitbrain.github.io/slika/) for details.

Operations
----------

[](#operations)

### resize

[](#resize)

All resize operations will keep the original aspect ratio of the image. There will be no distortion.

Keeping either width or height at zero will auto calculate the value for you.

```
# fit the image into a bounding box of 500x500 pixels
Slika::run('input.jpg')->resize(500,500)->save('output.png', 'png');

# adjust the image to a maximum width of 500 pixels
Slika::run('input.jpg')->resize(500,0)->save('output.png', 'png');

# adjust the image to a maximum height of 500 pixels
Slika::run('input.jpg')->resize(0,500)->save('output.png', 'png');
```

### crop

[](#crop)

Similar to resizing, but this time the image will be cropped to fit the new aspect ratio.

```
Slika::run('input.jpg')->crop(500,500)->save('output.png', 'png');
```

### rotate

[](#rotate)

Rotates the image. The parameter passed is one of the EXIF orientation flags:

[![orientation flags](https://camo.githubusercontent.com/4c9eff06db6242e3194ae3a6424e024ec07006da683859b9645f0d20fb2047c8/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f42467167752e676966)](https://camo.githubusercontent.com/4c9eff06db6242e3194ae3a6424e024ec07006da683859b9645f0d20fb2047c8/68747470733a2f2f692e737461636b2e696d6775722e636f6d2f42467167752e676966)

For your convenience there are three Constants defined:

- `Slika::ROTATE_CCW` counter clockwise rotation
- `Slika::ROTATE_CW` clockwise rotation
- `Slika::ROTATE_TOPDOWN` full 180 degree rotation

```
Slika::run('input.jpg')->rotate(Slika::ROTATE_CW)->save('output.png', 'png');
```

### autorotate

[](#autorotate)

Rotates the image according to the EXIF rotation tag if found.

```
Slika::run('input.jpg')->autorotate()->save('output.png', 'png');
```

Options
-------

[](#options)

Options can be passed as associatiave array as the second parameter in `Slika::run`.

The following options are availble currently:

OptionDefaultDescription`imconvert``/usr/bin/convert`The path to ImageMagick's `convert` binary`quality``92`The quality when writing JPEG images

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance78

Regular maintenance activity

Popularity25

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 89.3% 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 ~267 days

Recently: every ~501 days

Total

9

Last Release

72d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2851a48718937a41d7cc7ea185ec0ad95f3d5e4892e1693ed4f19b08a3f1e4ca?d=identicon)[splitbrain](/maintainers/splitbrain)

---

Top Contributors

[![splitbrain](https://avatars.githubusercontent.com/u/86426?v=4)](https://github.com/splitbrain "splitbrain (25 commits)")[![glensc](https://avatars.githubusercontent.com/u/199095?v=4)](https://github.com/glensc "glensc (1 commits)")[![schnackOpPlatt](https://avatars.githubusercontent.com/u/7623632?v=4)](https://github.com/schnackOpPlatt "schnackOpPlatt (1 commits)")[![suve](https://avatars.githubusercontent.com/u/5345765?v=4)](https://github.com/suve "suve (1 commits)")

---

Tags

cropgdimageimage-cropimage-processingimage-resizeimage-rotateimagemagicklibgdphpphp-libraryresize

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/splitbrain-slika/health.svg)

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

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

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