Rasmus Vind
Well-known member
Considering you decided to solve it for GD, here it is for Imagick.
Transparency in GIF and PNG are not persisted when resizing images. In fact, a transparent background becomes black for one one type and white for the another.
I wrote a little addon that extends the class XenForo_Image_ImageMagick_Pecl class:
But I think it makes more sense to make it part of XenForo.
It will make sure that transparency is kept when working with PNG and GIF.
Transparency in GIF and PNG are not persisted when resizing images. In fact, a transparent background becomes black for one one type and white for the another.
I wrote a little addon that extends the class XenForo_Image_ImageMagick_Pecl class:
PHP:
<?php
class Ranimavatars_Imagick extends XFCP_Ranimavatars_Imagick
{
protected function __construct(Imagick $image)
{
$image->setImageBackgroundColor(new ImagickPixel('transparent'));
$image->setImageAlphaChannel(imagick::ALPHACHANNEL_REMOVE);
$image->mergeImageLayers(Imagick::LAYERMETHOD_FLATTEN);
parent::__construct($image);
}
}
But I think it makes more sense to make it part of XenForo.
It will make sure that transparency is kept when working with PNG and GIF.