2017 © Pedro Peláez
 

library imagemanipulation

Library for image manipulation in PHP with GD

image

elgervb/imagemanipulation

Library for image manipulation in PHP with GD

  • Wednesday, January 10, 2018
  • by elgervb
  • Repository
  • 1 Watchers
  • 4 Stars
  • 117 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 3 Forks
  • 4 Open issues
  • 5 Versions
  • 2 % Grown

The README.md

IMAGEMANIPULATION

Build Status Latest Stable Versionbr/ Fork me on GitHub: https://github.com/elgervb/imagemanipulation Bitdeli Badge, (*1)

Library to manipulate images using PHP's GD library. Most of the functionality is available through the ImageBuilder facade. This way chaining of image filters and thumbnailing is possible, like:, (*2)

ImageBuilder::create( new \SplFileInfo('image.jpg') )
  ->contrast( 20 ) // increase contrast
  ->colorize( '#DB3636' ) // apply a bit of red the the image
  ->flip( ImageFilterFlip::FLIP_VERTICALLY ) // flip image vertically
  ->save( new \SplFileInfo( 'image.new.png' ) ) // save the jpg image as png with filters applied
  ->render( 80 ); // render to browser with quality 80

Installation

With composer.json:

    "require" : {
        "elgervb/imagemanipulation": "^1.0"
    }

Requirements

PHP version >= 5.3 with GD library, (*3)

FUNCTIONALITY

Filters

Lots of image filters. All of them listed below:, (*4)

  • brightness
  • colorize
  • comic
  • contrast
  • convolution 3x3 filters
  • darken
  • dodge
  • duotone
  • edge detect
  • emboss
  • find edges
  • flip (horizonal, vertical, both)
  • gamma correction
  • gaussian blur
  • grayscale
  • hue rotate
  • mean remove
  • motion blur
  • negative
  • noise
  • old cardboard
  • opacity
  • pixelate
  • random blocks with custom size and color
  • replace color
  • reverse
  • rounded corners
  • scatter
  • selective blur
  • semi grayscale
  • sepia
  • sepia fast
  • sharpen
  • smooth
  • sobel edge detect
  • sobel edge enhance (based on convolution matrix)
  • true color
  • vignette

Overlay

Use an image as overlay on another image. Can be configured with overlay opacity, start and end position and fill options., (*5)

Reflection

Use the current image to make a reflection below the original image, (*6)

Image repeater

Repeat images on a canvas, until it fits. This way we can create Warhol like images., (*7)

Rotate

Rotate images in degrees. When rotating an image not equal to 90, 180, 270 or 360 degrees, then optionally you can specify a background color for those oncovered edges., (*8)

Thumbnails

Create thumbnails on the fly. There are several strategies to use:, (*9)

  • Centered strategy: create a thumb from the center of an image. Ideal for creating square thumbs from not so square images
  • Max strategy: resize the image to a max width or height keeping proportions. For example: when resizing an image (300x750) on max 500 pixels, the resulting image will be 200x500 pixels
  • Percentage strategy: reduce the size of an image with a certain percentage.

Watermarking

Add a watermark to your image. Possible positions are: top, bottom, left, right, center, top right, top left, bottom right, bottom left., (*10)

Examples

Thumbnails

You can create thumbnails in several ways, (*11)

centered

create a thumbnail which is centered in the middle of the image, (*12)

Parameter Default Description
width 250 The new width of the image in pixels
height 250 The new height of the image in pixels

Examples
Centered Thumb Centered Thumb Centered Thumb, (*13)

max

resize the image to a max width or height keeping proportions, thus restraining the image to a certain size, (*14)

Parameter Default Description
width 250 The max width of the image in pixels
height 250 The max height of the image in pixels

Examples
Max Thumb Max Thumb Max Thumb, (*15)

percentage

reduce a image with a certain percentage, (*16)

Parameter Default Description
percentage 250 The percentage to reduce the image with

Examples
Max Thumb Max Thumb Max Thumb, (*17)

square

Parameter Default Description
width 250 The new width of the image in pixels
height 250 The new height of the image in pixels

Examples
Centered Thumb Centered Thumb Centered Thumb, (*18)

Available Filters

blocks

Add random blocks to an image with custom size and color, (*19)

Parameter Default Description
number 100 The number of blocks
size 25 The size of the blocks in pixels
color ffffff The color of the blocks

Examples
Blocks Filter Blocks Filter Blocks Filter, (*20)

brightness

Adjust the brightness of the image, either lighter or darker, (*21)

Parameter Default Description
rate 20 The brightness level from -255 to 255, from darker to lighter

Examples
Brightness Filter Brightness Filter Darker Brightness Filter Lighter, (*22)

colorize

Blends a fill color with the image, (*23)

Parameter Default Description
color ffffff The color to blend, either in hexadecimal or rgb(a)
opacity null The color opacity from 0 to 127

Examples
Colorize Filter Colorize Filter red Colorize Filter green, (*24)

comic

Apply a sketchy comic filter to an image, (*25)

Parameter Default Description
opacity 40 The opacity from 0 to 127

Examples
Comic Filter Comic Filter Comic Filter, (*26)

contrast

Changes the contrast of the image, (*27)

Parameter Default Description
rate 5 The opacity from -100 to 100, from minimal contrast to high constrast

Examples
Contrast Filter Contrast Filter Contrast Filter, (*28)

darken

Adjust the brightness of the image, either darker or lighter, (*29)

Parameter Default Description
rate 20 The brightness level from -255 to 255, from lighter to darker

Examples
Darken Filter Darken Filter Lighter Darken Filter Darker, (*30)

dodge

Dodge an image, resulting in a darker image, (*31)

Parameter Default Description
rate 75 The dodge level between 0 and 100

Examples
Dodge Filter Dodge Filter Lighter Dodge Filter Darker, (*32)

duotone

Duotone filter. Enhances Red, Green or Blue or a combination, (*33)

Parameter Default Description
red 0 The amount of red to add max = 255
green 0 The amount of green to add max = 255
blue 0 The amount of blue to add max = 255

Examples
Dodge Filter Dodge Filter Lighter Dodge Filter Darker, (*34)

edgedetect

Uses edge detection to highlight the edges in the image, (*35)

Examples
Edge detect Filter, (*36)

emboss

Embosses the image, (*37)

Examples
Edge detect Filter, (*38)

findedges

Find the edges in an image without color loss, (*39)

Examples
Edge detect Filter, (*40)

flip

Flips an image, (*41)

Parameter Default Description
mode both Direction to fip: vertical, horizontal or both

Examples
Flip Filter Flip Filter Vertical Flip Filter Horizontal, (*42)

gammacorrection

Applies gamma correction, (*43)

Parameter Default Description
input 1.0 Input
output 1.537 Output

Examples
Gamma Correction Filter Gamma Correction Vertical FlipGamma Correction Horizontal, (*44)

gaussianblur

Blurs the image using the Gaussian method., (*45)

Examples
Gaussian Blur Filter, (*46)

grayscale

Converts the colors to grayscale, (*47)

Examples
Gaussian Blur Filter, (*48)

huerotate

Rotete the hue of the image, (*49)

Parameter Default Description
rotate 90 degrees to rotate

Examples
Hue Rotate Filter Hue Rotate Filter Hue Rotate Filter, (*50)

meanremove

Uses mean removal to achieve a "sketchy" effect, (*51)

Examples
Gaussian Blur Filter, (*52)

motionblur

Motion blurs the image, (*53)

Examples
Gaussian Blur Filter, (*54)

negative

Create a negative of an image, (*55)

Examples
Gaussian Blur Filter, (*56)

noise

add noise to the image, (*57)

Parameter Default Description
rate 20 The amount of noise to apply

Examples
Noise Filter Noise Filter Noise Filter, (*58)

oldcardboard

Image filter to give the image an old cardboard look, (*59)

Examples
Gaussian Blur Filter, (*60)

opacity

Sets the opacity of an image, (*61)

Parameter Default Description
opacity 80 A value between 0 and 127. 0 indicates completely opaque while 127 indicates completely transparent.

Examples
Opacity Filter Opacity Filter Opacity Filter, (*62)

pixelate

Pixelate an image, (*63)

Parameter Default Description
rate 20 the blocksize in pixels

Examples
Pixelate Filter Pixelate Filter Pixelate Filter, (*64)

rotate

Rotate an image over an angle, (*65)

Parameter Default Description
degrees 90 The degrees to rotate the image
color null The background color to apply

Examples
Rotate Filter Rotate Filter Rotate Filter, (*66)

scatter

Scatter pixels around in a random way, (*67)

Parameter Default Description
rate 5 the scatter size in pixels

Examples
Scatter Filter Scatter Filter Scatter Filter, (*68)

selectiveblur

Image filter Selective Blur, (*69)

Examples
Selective blur Filter, (*70)

sepia

Apply sepia to the image, (*71)

Parameter Default Description
rate 15 the darken rate

Examples
Sepia Filter Sepia Filter Sepia Filter, (*72)

semigrayscale

Applies grayscale to an image, optionally add a grayscale percentage, (*73)

Parameter Default Description
rate 75 The grayscale rate

Examples
Sepia Filter Sepia Filter Sepia Filter, (*74)

sepiafast

Apply sepia to the image (fast), (*75)

Examples
Sepia fast Filter Sepia fast Filter Sepia fast Filter, (*76)

sharpen

Sharpens the image, (*77)

Examples
Sepia fast Filter, (*78)

smooth

Makes the image smoother., (*79)

Parameter Default Description
rate 5 the darken rate

Examples
Smooth Filter Smooth Filter Smooth Filter, (*80)

sobel

Sobel edge detect (extremely slow...), (*81)

Examples
Sobel Edge Detect Filter, (*82)

sobeledge

Sobel edge enhance, (*83)

Examples
Sobel Edge Detect Filter, (*84)

truecolor

Makes the image smoother., (*85)

Parameter Default Description
primary ffffff the primary color
secundary 000000 the secundary color

Examples
Smooth Filter Smooth Filter Smooth Filter, (*86)

vignette

Applies a darker mask around the edges of the image, (*87)

Examples
Smooth Filter, (*88)

The Versions

10/01 2018

dev-master

9999999-dev https://github.com/elgervb/imagemanipulation

Library for image manipulation in PHP with GD

  Sources   Download

MIT

The Development Requires

manipulation gd images image filters color utils image overlays image reflection image rotate image thumbnail image watermark

05/09 2017

dev-add-license-1

dev-add-license-1 https://github.com/elgervb/imagemanipulation

Library for image manipulation in PHP with GD

  Sources   Download

MIT

The Development Requires

manipulation gd images image filters color utils image overlays image reflection image rotate image thumbnail image watermark

02/09 2015

1.2.0

1.2.0.0 https://github.com/elgervb/imagemanipulation

Library for image manipulation in PHP with GD

  Sources   Download

MIT

The Requires

 

manipulation gd images image filters color utils image overlays image reflection image rotate image thumbnail image watermark

31/08 2015

1.1.0

1.1.0.0 https://github.com/elgervb/imagemanipulation

Library for image manipulation in PHP with GD

  Sources   Download

MIT

The Requires

 

manipulation gd images image filters color utils image overlays image reflection image rotate image thumbnail image watermark

27/08 2015

V1.0.0

1.0.0.0 https://github.com/elgervb/imagemanipulation

Library for image manipulation in PHP with GD

  Sources   Download

MIT

The Requires

 

manipulation gd images image filters color utils image overlays image reflection image rotate image thumbnail image watermark