Questions tagged [imagick]

Imagick is a native php extension to create and modify images using the ImageMagick library. Please upload example images to imgur.com (or other site) if your question is asking why Imagick is not producing the images you are expecting, so that people can reproduce your problem.

Imagick is a PHP extension to create and modify images using the ImageMagick library. There is also a version of Imagick available for HHVM. Although the two extensions are mostly compatible in their API, and they both call the ImageMagick library, the two extensions are completely separate code-bases.

ImageMagick® is a software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF.

The documentation for PHP Imagick is in the PHP Manual. A large number of examples for Imagick with code and the expected output are at PHPImagick.com


Resources :

1893 questions
11
votes
1 answer

PHP Imagick setImageOpacity destroys transparency and does nothing

Here's the thing. I hava a simple snippet in PHP like this regarding a transparent image: $im = new Imagick('some-transparent-image.png'); $im->setImageOpacity(0.3); $im->writeImage('output.png'); The file output should be a transparent image with…
Fotis
  • 1,322
  • 16
  • 30
10
votes
3 answers

PHP imagick detect transparency

I want to be able to detect whether an image is transparent or not using the Imagick PHP extension. So far, the only luck I've been having is to run the exec() / some other command, and use the ImageMagick command line tool to achieve this. Here's…
Scott
  • 101
  • 1
  • 3
10
votes
2 answers

Install imagick extension in Mac OS Catalina : php_imagick.h:42:10: fatal error: 'php.h' file not found

I've followed these steps to install imagemagick and php extension imagick in my computer with Mac OS Catalina and I can't seem to find a way. I always get the following error when trying to install imagick with $ sudo pecl install…
Alvaro
  • 40,778
  • 30
  • 164
  • 336
10
votes
6 answers

WordPress - Blur Image on Upload

So I'm following the example given here (which I modified to only blur, no watermark), to make a blurred image in WordPress on upload. The problem is, that if the uploaded file is the exact same size, or smaller, than the set size, then WordPress…
Drew Baker
  • 14,154
  • 15
  • 58
  • 97
10
votes
3 answers

Using a transparent PNG as a clip mask

Is it possible to take this image: And apply this mask: And turn it into this: Using either GD or Imagick? I know it's possible to mask an image using shapes but I'm not sure how to go on about doing it with a pre-created alphatransparent…
Jedi
  • 121
  • 1
  • 1
  • 4
9
votes
4 answers

PHP Imagick memory leak

I have to render something with Imagick on PHP CLI. I have noticed that every 3-5 days the server memory gets full, so i can't even connet via ssh or ftp. with memory_get_usage() i narrwoed the memory leak down to the imagick part of the script. the…
Slemgrim
  • 937
  • 2
  • 8
  • 23
9
votes
3 answers

how can i change the dpi of an image with the imagick extension

I need to change all uploaded files to 72 dpi. I'm using the php imagick extension. heres what i've tried (the image i'm using is 300dpi): $image = new Imagick(); $image->setResolution(72,72) ; $image->readImage($img); $image->resampleImage …
mononym
  • 2,606
  • 6
  • 26
  • 27
9
votes
3 answers

ImageMagick No decode delegate for this image format

I work under windows and wamp server. this is my PHP code with Imagick $imagick = new Imagick($_SERVER['DOCUMENT_ROOT'] . '/' . $this->_name); where $_SERVER['DOCUMENT_ROOT'].'/'.$this->_name displays :…
SmootQ
  • 2,096
  • 7
  • 33
  • 58
9
votes
7 answers

Install Imagick for PHP and Apache on Windows

Steps I've taken so far: I have installed Imagick on my Win7 machine, and it's installed and running properly via command line. I've extracted the contents of php_imagick-3.1.2-5.6-ts-vc11-x86.zip available here into my \PHP\ext directory. Enabled…
Benjam
  • 5,285
  • 3
  • 26
  • 36
9
votes
2 answers

Black background when converting multi page PDF to JPG with Imagick php extension

What is the best way to correct black background when converting multi page PDF to JPG with Imagick php extension? Following is the code used on my application: $imagick = new Imagick($file); $imagick->setResolution(150,150); …
fcaserio
  • 726
  • 1
  • 9
  • 18
9
votes
1 answer

Can't install Imagick for PHP on Debian

Pulling my hair out. PHP built from source, everything working. Now need to install imagick and can't get it installed. I am running Debian on kernel 3.7.1 with PHP 5.3.20 (the last version my app supports, cannot go to PHP 5.4). pecl install…
ctrlbrk
  • 1,174
  • 2
  • 17
  • 27
8
votes
1 answer

How to use imagick's writeImage() function?

This works if I keep the script in the same directory as the image being manipulated. And the resultant image "foo.jpg" is also generated in the same location. thumbnailImage( 200,…
user967451
8
votes
3 answers

Imagick colorizeImage Hex darker

I use PHP and Imagick to change the color of a transparent PNG. The image in the PNG is a simple shape with a transparent background. I use the colorizeImage function to change the color. $img = new…
pelelive
  • 617
  • 1
  • 6
  • 14
8
votes
1 answer

PHP Warning: PHP Startup: imagick: Unable to initialize module

I have read similar issues but I believe that the solution to mine might be new: I have recently upgraded my Windows 10 to PHP 8.2.1, and today I added extension=ext/php_imagick to php.ini, and when running php -v I get the following error: Warning:…
user3421985
  • 155
  • 1
  • 7
8
votes
2 answers

PHP+Imagick - PNG Compression

How do I efficiently compress a PNG? In my case, the images are small grayscale images with transparency. Currently I'm playing with this: //…
Czechnology
  • 14,832
  • 10
  • 62
  • 88