ImageMagick
class ImageMagick implements ProcessorInterface
ImageMagick processor.
Traits
Properties
protected Imagick | $image | Imagick instance. | |
protected Imagick|null | $snapshot | Imagick instance. |
Methods
Calculates new image dimensions.
Destructor.
Add the hash character (#) if its missing.
Opens the image we want to work with.
Creates a snapshot of the image resource.
Restores an image snapshot.
Returns the image width in pixels.
Returns the image height in pixels.
Returns an array containing the image dimensions in pixels.
Rotates the image using the given angle in degrees.
Resizes the image to the chosen size.
Crops the image.
Flips the image.
Adds a watermark to the image.
Adjust image brightness.
Converts image to greyscale.
Converts image to sepia.
Converts image to bitonal.
Colorize the image.
Sharpens the image.
Pixelates the image.
Negates the image.
Adds a border to the image.
Returns a string containing the image.
Saves image to file.
Details
in CalculateNewDimensionsTrait at line 30
protected array
calculateNewDimensions(int $width, int|null $height, int $oldWidth, int $oldHeight, int $aspectRatio)
Calculates new image dimensions.
at line 45
__destruct()
Destructor.
at line 64
string
normalizeHex(string $hex)
Add the hash character (#) if its missing.
at line 77
open(string $image)
Opens the image we want to work with.
at line 85
snapshot()
Creates a snapshot of the image resource.
at line 93
restore()
Restores an image snapshot.
at line 108
int
getWidth()
Returns the image width in pixels.
at line 116
int
getHeight()
Returns the image height in pixels.
at line 124
array
getDimensions()
Returns an array containing the image dimensions in pixels.
at line 132
rotate(int $degrees)
Rotates the image using the given angle in degrees.
at line 140
resize(int $width, int|null $height = null, int $aspectRatio = Image::RESIZE_IGNORE)
Resizes the image to the chosen size.
at line 153
crop(int $width, int $height, int $x, int $y)
Crops the image.
at line 161
flip(int $direction = Image::FLIP_HORIZONTAL)
Flips the image.
at line 180
watermark(string $file, int $position = Image::WATERMARK_TOP_LEFT, int $opacity = 100)
Adds a watermark to the image.
at line 225
brightness(int $level = 50)
Adjust image brightness.
at line 233
greyscale()
Converts image to greyscale.
at line 241
sepia()
Converts image to sepia.
at line 249
bitonal()
Converts image to bitonal.
at line 257
colorize(string $color)
Colorize the image.
at line 265
sharpen()
Sharpens the image.
at line 273
pixelate(int $pixelSize = 10)
Pixelates the image.
at line 287
negate()
Negates the image.
at line 295
border(string $color = '#000', int $thickness = 5)
Adds a border to the image.
at line 305
string
getImageBlob(string $type = null, int $quality = 95)
Returns a string containing the image.
at line 327
save(string $file, int $quality = 95)
Saves image to file.