php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59390 Opacity fails
Submitted: 2010-08-30 09:59 UTC Modified: 2010-08-30 12:24 UTC
From: junkboypaul at hotmail dot com Assigned:
Status: Not a bug Package: imagick (PECL)
PHP Version: 5.2.11 OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: junkboypaul at hotmail dot com
New email:
PHP Version: OS:

 

 [2010-08-30 09:59 UTC] junkboypaul at hotmail dot com
Description:
------------
When using opacity, it seems to work ok, until I use roundCorners, once I do this, what should be transparent, goes black

Reproduce code:
---------------
<?php
	$im = new Imagick();
	$im->newImage(400,400,new ImagickPixel('green'), 'png');
	$im->roundCorners(50,50);
	$im->setImageOpacity(0.5);
	header('Content-Type: image/' . $im->getImageFormat());
	echo $im->getImageBlob();

Expected result:
----------------
Outside of the green section should be transparent

Actual result:
--------------
Outside of the green has gone black

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-30 12:23 UTC] mkoppanen@php.net
Hi,

setImageOpacity _sets_ the opacity of the whole image. So in your case when you have fully opaque parts in the image setImageOpacity(0.5) changes those parts to 50% opaque.
 [2010-08-30 12:24 UTC] mkoppanen@php.net
If you actually want to reduce opacity on whole image use:

$im->evaluateImage(Imagick::EVALUATE_DIVIDE, 2, Imagick::CHANNEL_ALPHA);
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 06 07:01:33 2025 UTC