Search code examples
pdfimagemagicktypo3srgb

Why do ImageMagick-based thumbnail-images of PDF-files in Typo3 have black background?


Since version 6.7.5, ImageMagick has changed its colorspace from RGB to sRGB. Because of that I also had to change the setting [GFX][colorspace] = sRGB in the configuration of my Typo3 CMS software that makes use of ImageMagick. Everything is working fine again - except thumbnail-creation for PDF-files that now always have a black background (should be white).

It's possible to see all non-black elements of PDF-files (like images etc) on the thumbnails, but all the background that would usually be white is now black. This error only happens for PDF-files. All other image-thumbnails for JPG-, GIF- and PNG-files look as expected (even if they have transparent background).

Does anyone have an idea how I could solve this problem? Is this an ImageMagick-issue or a Typo3-Issue?


Solution

  • Based on Creating JPG thumbnails from PDF causes problems with new version of ImageMagick I was able to answer this question by myself. If your want to apply this solution to Typo3, the following file changes are needed:

    Go to your Typo3 directory and open the file ./t3lib/class.t3lib_stdgraphic.php and replace all appearances of $this->cmds['jpeg'] = '-colorspace ' . $this->colorspace . ' with $this->cmds['jpeg'] = '-colorspace ' . $this->colorspace . ' -flatten