Index: src/wp-includes/class-wp-image-editor-imagick.php
===================================================================
--- src/wp-includes/class-wp-image-editor-imagick.php	(revision 39619)
+++ src/wp-includes/class-wp-image-editor-imagick.php	(working copy)
@@ -367,7 +367,8 @@
 
 			// Set appropriate quality settings after resizing.
 			if ( 'image/jpeg' == $this->mime_type ) {
-				if ( is_callable( array( $this->image, 'unsharpMaskImage' ) ) ) {
+				// Not compatible with CMYK color spaces.
+				if ( is_callable( array( $this->image, 'unsharpMaskImage' ) && Imagick::COLORSPACE_CMYK !== $this->image->getImageColorspace() ) ) {
 					$this->image->unsharpMaskImage( 0.25, 0.25, 8, 0.065 );
 				}
 
Index: tests/phpunit/tests/image/editor_imagick.php
===================================================================
--- tests/phpunit/tests/image/editor_imagick.php	(revision 39619)
+++ tests/phpunit/tests/image/editor_imagick.php	(working copy)
@@ -542,4 +542,27 @@
 
 		$this->assertTrue( $result );
 	}
+
+	/**
+	 * @ticket 39331
+	 */
+	public function test_cmyk_jpg_resize() {
+		$test_file = DIR_TESTDATA . '/images/test_cmyk.jpg';
+		$save_to_file = tempnam( get_temp_dir(), '' ) . '.jpg';
+
+		$editor = new WP_Image_Editor_Imagick( $test_file );
+		$editor->load();
+		$editor->resize( 106, 150 ); // Default thumbnail size.
+		$editor->save( $save_to_file );
+
+		// Use GD as Imagick seems to do some color mapping of CMYK images.
+		$gd_image = imagecreatefromjpeg( $save_to_file );
+		// Not sure how system-independent this is.
+		// Pixel (15, 10) should be white.
+		$output = dechex( imagecolorat( $gd_image, 15, 10 ) );
+		imagedestroy( $gd_image );
+		$this->assertSame( 'ffffff', $output );
+
+		unlink( $save_to_file );
+	}
 }
