Page 1 of 1

Colorize an image with transparenz

Posted: 2010-11-03T13:26:41-07:00
by destroyed
Hello,
I'm searching for a way to colourize an image by another colour-layer but the results so far let a bit to be desired.

This is the image which should be recoloured:
Image

This is the colour-layer:
Image

This is the result so far:
Image

Here is my Code:

Code: Select all

private function colorizeVinyl(){
		$colorWand = new Imagick();
		$colorWand->newImage(600,600,$this->color,"png");
		
		$this->vinylimage->setImageVirtualPixelMethod(Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);
		$this->vinylimage->setImageMatte(true);
		$this->vinylimage->compositeImage($colorWand,Imagick::COMPOSITE_ADD,0,0);
		
		echo $this->vinylimage;
	}
I've already tried some other composite filters but none shows the desired result. In Photoshop the layermode is called "linear dodge".

I hope somebody can help me with this problem.

Re: Colorize an image with transparenz

Posted: 2010-11-03T14:03:47-07:00
by fmw42
In Imagick look up the equivalent of the command line functions -fill and -colorize. see http://us3.php.net/manual/en/function.i ... eimage.php

convert blackeh.png -fill "#3a633c" -colorize 50% blackeh_colorize50.png
Image


convert blackeh.png -fill "#3a633c" -colorize 75% blackeh_colorize75.png
Image


convert blackeh.png -fill "#3a633c" -colorize 100% blackeh_colorize100.png
Image

Re: Colorize an image with transparenz

Posted: 2010-11-04T00:36:17-07:00
by destroyed
Thanks for the answer but the result hast not the same luminance as the source.
I have found a way which works perfect but its needs to do a part by command line.
convert "source.png" "color.png" -compose LinearDodge -composite "tmp.png"

Code: Select all

private function colorizeVinyl(){
		$colorWand = new Imagick();
		$colorWand->newImage($this->size,$this->size,$this->color,"png");
		$colorWand->writeImage($this->path_Temp."/tmp.png");
		$colorWand = null;
		exec("convert \"".$this->path_Rohling."\" \"".$this->path_Temp."tmp.png\" -compose LinearDodge -composite \"".$this->path_Temp."tmp.png\"");
		$this->vinylimage = new Imagick($this->path_Temp."tmp.png");
}
Does anyone know how to use the LinearDodge compositing option in imagick? It seems that they is not included at the moment.

regards,
destroyed

Re: Colorize an image with transparenz

Posted: 2010-11-14T22:49:22-07:00
by anthony
It should be applied in that same way that any composition is done in IMagick.

Re: Colorize an image with transparenz

Posted: 2010-11-15T07:05:50-07:00
by destroyed
Yes but there is no constant for that mode.

Re: Colorize an image with transparenz

Posted: 2010-11-15T12:20:05-07:00
by fmw42
Imagick was not created nor supported by ImageMagick. You need to contact the creator of Imagick. I believe memberlist.php?mode=viewprofile&u=8923