WordPress.org

Make WordPress Core

Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#46318 closed defect (bug) (duplicate)

Black backgrounds in PDF thumbnails

Reported by: rdiazg Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.1
Component: Media Keywords: has-screenshots
Focuses: Cc:
PR Number:

Description

When an user upload some pdfs which contain alpha layers to the media library, the thumbnail preview appears with a unwanted black background. Imagemagick's functions "class-wp-image-editor-imagick.php" not support hooks or filters to fix this behaviour. For testing purposes I was trying fix this with some code like:

<?php
            if ( 'pdf' == $file_extension ) {
                $this->image->setImageAlphaChannel(Imagick::ALPHACHANNEL_REMOVE);
                $this->image->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN);
            }

in

https://github.com/WordPress/WordPress/blob/master/wp-includes/class-wp-image-editor-imagick.php#L156

And it's works for me but I don't know how this change affect to the others wordpress features that call this method. Could someone have a look at this?

Thanks in advance.

Attachments (1)

PDF_BLACK_BACKGROUND.png (13.6 KB) - added by rdiazg 10 months ago.

Download all attachments as: .zip

Change History (3)

#1 @swissspidy
10 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi there and welcome to Trac!

It looks like we are already tracking this in #45982. Let's discuss possible solutions there.

#2 @rdiazg
10 months ago

Sure, thanks for your quick reply :)

Note: See TracTickets for help on using tickets.