The Imagick Function lets you create and change images using the ImageMagick
API. ImageMagick is a software suite that helps you make, edit, and modify
bitmap images. It reads, writes, and converts images in many formats like DPX,
EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF.
Requirements: You need PHP 5.1.3 and ImageMagick 6.2.4 to install
ImageMagick.
Here is an example of how to use the Imagick::brightnessContrastImage()
function in PHP.
<?php // require_once('path/vendor/autoload.php'); // Create a new Imagick Object $image = new Imagick( 'https://Your_Image_URL.png'); // brightnessContrastImage Function $image->brightnessContrastImage(12, 30); header('Content-type: image/png'); // Display the output image echo $image; ?>
Replace "https://Your_Image_URL.png" with the image URL you want to
adjust the brightness and contrast.
This PHP code shows how to adjust the brightness and contrast of an image using the Imagick library.
The complete list of Imagick s are given below:
Imagick Functions | Description |
---|---|
Imagick::adaptiveBlurImage() | Add an adaptive blur filter in the given image. |
Imagick::adaptiveResizeImage() | Resize the image according to websites. |
Imagick::adaptiveSharpenImage() | The intensity of an adaptive sharpen image depends on dramatically decreased at the edge of the image. |
Imagick::adaptiveThresholdImage() | Select a threshold for each pixel based on intensity values in its local neighborhood. |
Imagick::addImage() | Add new images to the Imagick object image list. |
Imagick::addNoiseImage() | Add noise to a given image. |
Imagick::annotateImage() | Annotates an image with text. |
Imagick::appendImages() | Append a set of images. |
Imagick::autoLevelImage() | Adjust the levels of a particular image channel. |
Imagick::blackThresholdImage() | The threshold value into black while leaving all pixels above the threshold unchanged. |
Imagick::blueShiftImage() | Mute the colors of the image to simulate a scene at nighttime in the moonlight. |
Imagick::blurImage() | Returns True on success. |
Imagick::borderImage() | Draw the border in an image. |
Imagick::brightnessContrastImage() | Accepts three parameters like Brightness, Contrast and Image channel. |
Imagick::charcoalImage() | Simulate a charcoal drawing of an image. |
Imagick::chopImage() | Remove the region of an image and trim it. |
Imagick::commentImage() | Add the comment in an image. |
Imagick::convolveImage() | Custom convolution kernel to the image. |
Imagick::cropImage() | Extract the region of the image. |
Imagick::despeckleImage() | Reduce the speckle noise in an image while preserving the edges of the original image. |
Imagick::displayImage() | Displays an image object. |
Imagick::distortImage() | Distorts an image using various distortion methods. |
Imagick::edgeImage() | Enhance the edges within the image. |
Imagick::embossImage() | Return a grayscale image with a three-dimensional effect. |
Imagick::enhanceImage() | Improve the quality of a noisy image. This applies the digital filter to improve quality. |
Imagick::equalizeImage() | Equalizes the histogram of an image. |
Imagick::extentImage() | Sets the image size and allows to set x, y coordinates where the new area of the image begins. |
Imagick::flattenImages() | Merges the sequence of images. |
Imagick::flipImage() | Create an image generated by a mirror-reversal of an original image across a vertical mirror. |
Imagick::flopImage() | Create a horizontal mirror image. |
Imagick::gammaImage() | Corrects the image by providing the Gamma-correction. |
Imagick::getCopyright() | Returns the current ImageMagick API copyright which is used as a string. |
Imagick::getImageBluePrimary() | Returns the chromaticity blue primary point. |
Imagick::getImageColors() | Get the number of unique colors in the image. |
Imagick::getImageColorspace() | Get the colorspace of the image. |
Imagick::getImageChannelDepth() | Get the depth for channel image. |
Imagick::getImageChannelRange() | Gets the range of channel. |
Imagick::getImageDepth() | Gets the depth of the image. |
imagick::getImageDispose() | Get the image disposal method. |
Imagick::getImageFormat() | Get the format of a particular image in a sequence |
Imagick::getImageGeometry() | Width and height as an associative array. |
Imagick::getImageGamma() | Encode and decode luminance or tristimulus values in images. |
Imagick::getImageHeight() | Get the height of the image. |
Imagick::getImageLength() | Get the length of an image object in bytes |
Imagick::getImageMatte() | Get the matte channel of an imagick object. |
Imagick::getImageMimeType() | Get MIME type of an imagick object |
Imagick::getImagePage() | Get the page geometry of a particular image. |
Imagick::getImageRenderingIntent() | Get the image rendering intent. |
Imagick::getImageResolution() | Get the resolution of an image object. |
Imagick::getImageScene() | Get the image scene of an Imagick object. |
Imagick::getImageSignature() | Generate an SHA-256 message digest for an image. |
Imagick::getImageUnits() | Get the units of resolution of a particular image. |
Imagick::getImageWhitePoint() | Get the chromaticity white point of an Imagick object. |
Imagick::getImageWidth() | Get the width of the image. |
Imagick::getInterlaceScheme() | Get the object interlace scheme. |
Imagick::getImageTicksPerSecond() | Get the image ticks-per-second. |
Imagick::getPackageName() | Get the ImageMagick package name. |
Imagick::getQuantumRange() | Get the Imagick quantum range of an Imagick object. |
Imagick::getQuantumDepth() | Get the quantum depth of an Imagick object. |
Imagick::getVersion() | Get the ImageMagick API version. |
Imagick::haldClutImage() | Replace colors in the image using a Hald lookup table. |
Imagick::identifyImage() | Identify an image and return its attributes. |
Imagick::magnifyImage() | Scale an image proportionally to 2x. |
Imagick::minifyImage() | Scale an image proportionally to half of its size. |
Imagick::modulateImage() | Control the brightness, saturation, and hue of an image. |
Imagick::morphImages() | It is used to morph a set of images. |
Imagick::motionBlurImage() | This is used to simulate motion blur. |
Imagick::negateImage() | It is used to negate the colors in the reference image. |
Imagick::newImage() | It is used to create a new image. |
Imagick::newPseudoImage() | Creates a new image using ImageMagick pseudo-formats. |
Imagick::normalizeImage() | Enhances the contrast of a color image by adjusting the color of the pixel to span the entire range of colors available. |
Imagick::oilPaintImage() | Simulates an oil painting. |
Imagick::orderedPosterizeImage() | Performs an ordered dither based on a number of pre-defined dithering threshold maps, but over multiple intensity levels |
Imagick::posterizeImage() | Reduces the image to a limited number of color level. |
Imagick::queryFonts() | Returns the configured fonts of the Imagick library. |
Imagick::radialBlurImage() | Create a radial blur image. |
Imagick::raiseImage() | Create a simulated three-dimensional button-like effect by lightening and darkening the edges of the image. |
Imagick::randomThresholdImage() | Change the value of individual pixels based on the intensity of each pixel compared to the threshold. |
Imagick::readImageBlob() | Read an image from a binary string. |
Imagick::recolorImage() | Translate, scale, shear, or rotate image colors. |
Imagick::reduceNoiseImage() | Smooth the contours of an image while preserving edge information. |
Imagick::resampleImage() | Resample the image to the desired resolution |
Imagick::rollImage() | It is used to roll an image. |
Imagick::rotationalBlurImage() | Apply the blur over an image by a certain angle. |
Imagick::rotateImage() | Rotate an image by a given angle and the empty spaces filled with given color. |
Imagick::textureImage() | Creates repeatedly tiles the texture image |
Imagick::thumbnailImage() | Changes the size of an image to the given dimensions and removes any associated profiles. |
Imagick::thresholdImage() | Changes the value of individual pixels based on the threshold value. |
Imagick::transformImage() | Crop size and image geometry. |
Imagick::transformImageColorspace() | Transforms an image into a new colorspace. |
Imagick::transposeImage() | Create a vertical mirror image. |
Imagick::transverseImage() | Create a horizontal mirror image by reflecting the pixels around the y-axis. |
Imagick::trimImage() | Remove the edges from the image. |
Imagick::setImageChannelDepth() | Set the depth of a particular channel image. |
Imagick::setImageDepth() | Sets the depth of the image. Image depth refers to the number of bits used to store the color information for each pixel. Higher depth means more colors can be represented. |
Imagick::setImageDispose() | Sets the image disposal method. |
Imagick::setImageOpacity() | Set the opacity level of an Imagick object. |
Imagick::setImageMatte() | Set the matte channel of an Imagick object. |
Imagick::setImageResolution() | Set the resolution of an image object. |
Imagick::setImageRenderingIntent() | Sets the image rendering intent. |
Imagick::setImageUnits() | Set the units of resolution of a particular image. |
Imagick::shadeImage() | Creates a 3D effect of a given image. |
Imagick::sharpenImage() | It is used to sharpen an image. |
Imagick::shaveImage() | Shaves pixels from the image edges. |
Imagick::shearImage() | It is used to create a parallelogram. |
Imagick::sketchImage() | This is used to simulate a pencil sketch. |
Imagick::statisticImage() | Replace each pixel with corresponding statistics from the neighborhood of the specified width and height. |
Imagick::solarizeImage() | Applies a solarizing effect to the image. |
Imagick::spliceImage() | Splices a solid color into the image. |
Imagick::spreadImage() | Randomly displaces each pixel in a block defined by the radius parameter. |
Imagick::unsharpMaskImage() | convolves the image with a Gaussian operator of the given radius and standard deviation. |
Imagick::uniqueImageColors() | Discards all but one of any pixel color. |
Imagick::vignetteImage() | Add a vintage filter to the image. |
Imagick::waveImage() | Create the wave filter in an image. |
Imagick::whiteThresholdImage | Convert all pixels above the threshold value into white. |