Index: src/wp-includes/class-wp-image-editor-imagick.php
===================================================================
--- src/wp-includes/class-wp-image-editor-imagick.php	(revision 56093)
+++ src/wp-includes/class-wp-image-editor-imagick.php	(working copy)
@@ -166,6 +166,10 @@
 				$this->image->setIteratorIndex( 0 );
 			}
 
+			if ( 'pdf' === $file_extension ) {
+				$this->pdf_process();
+			}
+
 			$this->mime_type = $this->get_mime_type( $this->image->getImageFormat() );
 		} catch ( Exception $e ) {
 			return new WP_Error( 'invalid_image', $e->getMessage(), $this->file );
@@ -746,6 +750,28 @@
 	}
 
 	/**
+	 * Process PDF after it's been read.
+	 *
+	 * @since  6.3.0
+	 * @access protected
+	 *
+	 * @return void
+	 */
+	protected function pdf_process() {
+		$version = Imagick::getVersion();
+		// Remove alpha channel if possible to avoid black backgrounds for Ghostscript >= 9.14. RemoveAlphaChannel added in ImageMagick 6.7.5.
+		if ( $version['versionNumber'] >= 0x675 ) {
+			try {
+				// Imagick::ALPHACHANNEL_REMOVE mapped to RemoveAlphaChannel in PHP imagick 3.2.0b2.
+				$this->image->setImageAlphaChannel( defined( 'Imagick::ALPHACHANNEL_REMOVE' ) ? Imagick::ALPHACHANNEL_REMOVE : 12 );
+			}
+			catch ( Exception $e ) {
+				return new WP_Error( 'pdf_alpha_process_failed', $e->getMessage() );
+			}
+		}
+	}
+
+	/**
 	 * @since 3.5.0
 	 * @since 6.0.0 The `$filesize` value was added to the returned array.
 	 *
Index: tests/phpunit/data/images/test-alpha.pdf
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tests/phpunit/data/images/test-alpha.pdf
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+application/octet-stream
\ No newline at end of property
Index: tests/phpunit/tests/image/editorImagick.php
===================================================================
--- tests/phpunit/tests/image/editorImagick.php	(revision 56093)
+++ tests/phpunit/tests/image/editorImagick.php	(working copy)
@@ -641,4 +641,33 @@
 
 		$this->assertNotWPError( $saved );
 	}
+
+	/**
+	 * @ticket 39216
+	 * Only affects systems with Ghostscript version >= 9.14.
+	 */
+	public function test_remove_alpha_pdf_preview() {
+		if ( ! wp_image_editor_supports( array( 'mime_type' => 'application/pdf' ) ) ) {
+			$this->markTestSkipped( 'Rendering PDFs is not supported on this system.' );
+		}
+
+		$test_file = DIR_TESTDATA . '/images/test-alpha.pdf';
+		$attachment_id = $this->factory->attachment->create_upload_object( $test_file );
+		$this->assertNotEmpty( $attachment_id );
+
+		$attached_file = get_attached_file( $attachment_id );
+		$this->assertNotEmpty( $attached_file );
+
+		$rgb = array( 'r' => true, 'g' => true, 'b' => true ); // Used for intersecting - not interested in alpha channel.
+		$expected = array( 'r' => 1, 'g' => 1, 'b' => 1 ); // White.
+
+			$check = image_get_intermediate_size( $attachment_id, 'full' );
+		$this->assertNotEmpty( $check['file'] );
+		$check_file = path_join( dirname( $attached_file ), $check['file'] );
+
+		$imagick = new Imagick( $check_file );
+		$output = array_map( 'round', array_intersect_key( $imagick->getImagePixelColor( 100, 100 )->getColor( true /*normalized*/ ), $rgb ) );
+		$imagick->destroy();
+		$this->assertEquals( $expected, $output ); // Allow for floating point equivalence.
+	}
 }
