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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 06:01:29 2024 UTC