Eric T
Eric T

Reputation: 1026

Compatible issues with Imagick Transparent?

I have my local with version ImageMagick 6.7.3-10 (PHP 5.2.10) and server side with ImageMagick 6.5.4-7 (PHP 5.3.9). It happened that server side doesn't generate transparent background but other colours still working. However local are just good with transparent background. Anyway I can solve in order to use transparent background on server side?

$canvas  = new Imagick();
$canvas->newImage( $size, $size, new ImagickPixel( 'transparent' ) );

Upvotes: 2

Views: 1933

Answers (4)

Tom McQuarrie
Tom McQuarrie

Reputation: 1147

I had the same issue with code developed locally not working in production for transparent pixels. I tried all the solutions above and transparency simply wasn't working. In the end I changed $im->setImageFormat( 'png24' ); to $im->setImageFormat( 'png' ); and it all started working again. "png24" format must have been added later.

Upvotes: 1

user3412922
user3412922

Reputation: 11

make sure that you save the result in a format that actually supports transparancy... thus NOT JPG, but GIF or PNG.... It sounds simple, but too often this is forgotten (especially when not explicitly defined)

Upvotes: 1

Ondřej Želazko
Ondřej Želazko

Reputation: 659

Well for me didn't work 'none' nor 'transparent' but 'rgba(250,15,150,0)' had ended my long agony with Imagick trully sparse documentation.

Upvotes: 4

Bonzo
Bonzo

Reputation: 5299

Have you tried none rather than transparent?

Another answer from Stackoverflow: Setting an alpha channel when constructing an ImagickPixel

Upvotes: 2

Related Questions