Reputation: 259
Uploading and using tiff or bmp files in TYPO3 and including them via f:image results them in beeing converted into gif files. Im using ImageMagick. I couldn't find anything about this issue but i wonder, because even uploading 100% jpg files results into double compression, while uploading bmp and tiff doesn't. Any ideas how to configure typo3 to convert tiff and bmp into jpg and not gif? Can't imagine that this is the right behavior.
edit:
i found out that the decision for the output format is done at
TYPO3\CMS\Core\Resource\Processing\AbstractGraphicalTask::determineTargetFileExtension
If there is no configuration given it will use gif or png for all non-jpg images. I overloaded the
\TYPO3\CMS\Core\Resource\Processing\ImageCropScaleMaskTask
which extends the AbstractGraphicalTask and rewrote the function to properly convert bmp and tiff.
Overwrite the default fal config in ext_localconf.php
$GLOBALS['TYPO3_CONF_VARS']['SYS']['fal']['processingTaskTypes']['Image.CropScaleMask'] = \i3\I3Content\Resource\Processing\ImageCropScaleMaskTask::class;
New function:
protected function determineTargetFileExtension() {
if (!empty($this->configuration['fileExtension'])) {
$targetFileExtension = $this->configuration['fileExtension'];
} else {
// explanation for "thumbnails_png"
// Bit0: If set, thumbnails from non-jpegs will be 'png', otherwise 'gif' (0=gif/1=png).
// Bit1: Even JPG's will be converted to png or gif (2=gif/3=png)
$targetFileExtensionConfiguration = $GLOBALS['TYPO3_CONF_VARS']['GFX']['thumbnails_png'];
if ($this->getSourceFile()->getExtension() === 'jpg' || $this->getSourceFile()->getExtension() === 'jpeg') {
if ($targetFileExtensionConfiguration == 2) {
$targetFileExtension = 'gif';
} elseif ($targetFileExtensionConfiguration == 3) {
$targetFileExtension = 'png';
} else {
$targetFileExtension = 'jpg';
}
} else {
// check if a png or a gif should be created
if ($targetFileExtensionConfiguration == 1 || $this->getSourceFile()->getExtension() === 'png') {
$targetFileExtension = 'png';
} elseif($this->getSourceFile()->getExtension() === 'tif' || $this->getSourceFile()->getExtension() === 'tiff' || $this->getSourceFile()->getExtension() === 'bmp') {
$targetFileExtension = 'jpg';
} else {
// thumbnails_png is "0"
$targetFileExtension = 'gif';
}
}
}
return $targetFileExtension;
}
Upvotes: 1
Views: 433
Reputation: 853
Check the $TYPO3_CONF_VARS[GFX][thumbnails_png]
setting through install tool. There are various options how to convert different formats when resizing images.
Upvotes: 2