Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unrecognized color string for colorizeImage() and tintImage() #182

reinvanoyen opened this issue Nov 2, 2016 · 2 comments


None yet
2 participants
Copy link

commented Nov 2, 2016

I just updated Imagick from 3.3.0 to 3.4.0.

This seems to break the old usage of the methods colorizeImage and tintImage eg:

$imagick->colorizeImage('rgba(150,90,50)', 1);

I get an Unrecognized color string for colorizeImage().

The changelog states:

Imagick::colorizeImage() and Imagick::tintImage were using the wrong behaviour.
It is now fixed and the legacy behaviour can still be used by passing a 3rd parameter of true to the function to indicate that the legacy behaviour is desired.

What exactly does "wrong behaviour" mean? How exactly are the methods meant to be used now (without adding the 3rd parameter..)? Do they only accept a ImagickPixel object now?


This comment has been minimized.

Copy link

commented Dec 2, 2016

What exactly does "wrong behaviour" mean?

It was not passing the value into the underlying ImageMagick library correctly. It was passing in a 'PixelWand' (which is how ImageMagick stores colors), with just the opacity set, not the RGB channels.

It wasn't possible to reproduce the results of using tint image from the ImageMagick command line tools in Imagick

If you want to see the code, it's in

	if (legacy) {
		opacity_wand = php_imagick_zval_to_opacity(opacity_param, IMAGICK_CLASS, &opacity_allocated TSRMLS_CC);
	else {
		opacity_wand = php_imagick_zval_to_pixelwand(opacity_param, IMAGICK_CLASS, &opacity_allocated TSRMLS_CC);

This comment has been minimized.

Copy link

commented Dec 2, 2016

And yes, please pass in true as the 3rd parameter to make your code work again:

$imagick->colorizeImage('rgba(150,90,50)', 1, true);

seems to work for me.

@Danack Danack closed this Dec 2, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.