Title: PHP Deprecated:  Imagick::flattenImages
Last modified: August 31, 2016

---

# PHP Deprecated: Imagick::flattenImages

 *  Resolved [tasker204](https://wordpress.org/support/users/tasker204/)
 * (@tasker204)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/php-deprecated-imagickflattenimages/)
 * I am getting this error on pdf upload.
 * PHP Deprecated: Imagick::flattenImages method is deprecated and it’s use should
   be avoided in …/plugins/pdf-image-generator/pdf-image-generator.php on line 210
 * I am running:
    imagemagick 6.9.3-6 ghostscript 9.18 imagick 3.3.0_1
 * should I be running an older version of something??
 * [https://wordpress.org/plugins/pdf-image-generator/](https://wordpress.org/plugins/pdf-image-generator/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [tasker204](https://wordpress.org/support/users/tasker204/)
 * (@tasker204)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/php-deprecated-imagickflattenimages/#post-7182617)
 * Fixed the issue…
 * replaced line 210 of pdf-image-generator.php
 *     ```
       $imagick = $imagick->flattenImages();
       ```
   
 * with
 *     ```
       $imagick->setImageAlphaChannel(imagick::ALPHACHANNEL_REMOVE);
       $imagick->mergeImageLayers(imagick::LAYERMETHOD_FLATTEN);
       ```
   
 *  Plugin Author [Mizuho Ogino](https://wordpress.org/support/users/fishpie/)
 * (@fishpie)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/php-deprecated-imagickflattenimages/#post-7182782)
 * Hi, thanks for great feedback!
 * I changed the code:
 *     ```
       $imagick = $imagick->flattenImages();
       ```
   
 * with
 *     ```
       $imagick->setImageAlphaChannel(11);
       $imagick->mergeImageLayers(imagick::LAYERMETHOD_FLATTEN);
       ```
   
 * setImageAlphaChannel(imagick::ALPHACHANNEL_REMOVE) doesn’t work with older version
   like flattenimages() with newer version.
 * Tell me if you have any problems with updating it.
 * Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP Deprecated: Imagick::flattenImages’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/pdf-image-generator_c3bea9.svg)
 * [PDF Image Generator](https://wordpress.org/plugins/pdf-image-generator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pdf-image-generator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pdf-image-generator/)
 * [Active Topics](https://wordpress.org/support/plugin/pdf-image-generator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pdf-image-generator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pdf-image-generator/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Mizuho Ogino](https://wordpress.org/support/users/fishpie/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/php-deprecated-imagickflattenimages/#post-7182782)
 * Status: resolved