I'm trying to make with Imagick the same as ImageMagick command:
[code]combine -compose over input.jpg over.gif black&white_mask.gif output.jpg[/code]
The output file should consist of input & over files - depending on mask file.
How can I achieve this?
compose over
compose over
cheers
tk1
tk1
Re: compose over
I tried compositeImage() with no success. combine takes 4 files and does the magick. compositeImage() works on 2 files, composite constant and coordinates. I just don't know how put it all together. Could you help me a little bit more?
cheers
tk1
tk1
Re: compose over
The problem tk1 is that Imagick is not written or supported by the IM developers and you probably know as much as everybody else that uses the forum!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: compose over
You said nothing about combine only composite. So please clarify what you need?combine takes 4 files and does the magick
If necessary post all your code.
Unfortunately, I do not code Imagick and have only tested a few limited functions.
What version of IMagick and Imagemagick are you using? Perhaps you have the older Imagick. Current version of IMagick is at
http://pecl.php.net/package/imagick/3.1.0RC2
Re: compose over
Guys. I didn't mean to offend anybody. This is Imagick section of the forum. This is why I asked here.
Maybe I misunderstood, but combine.exe command was replaced with composite.exe. Am I right?
Those commands I would like to convert to Imagick.
composite.exe -compose over input.jpg over.gif black&white_mask.gif output.jpg
and
composite.exe -compose over input.jpg over.jpg black&white_mask.gif output.jpg
Images are the same geometry. In both cases I would like to transform input and over images through b&w mask.
Black color from the mask should be replaced with the same part from over image.
White color from the mask should be replaced withthe same part from input image.
I'm trying to write equivalent code in Imagick.
This is result of my today's struggling. It looks it does almost what I need. Could anybody suggest what can be done in better way?
I use ImageMagick 6.7.9-4 Q8 and Imagick 3.1.0RC2 and RC1.
Maybe I misunderstood, but combine.exe command was replaced with composite.exe. Am I right?
Those commands I would like to convert to Imagick.
composite.exe -compose over input.jpg over.gif black&white_mask.gif output.jpg
and
composite.exe -compose over input.jpg over.jpg black&white_mask.gif output.jpg
Images are the same geometry. In both cases I would like to transform input and over images through b&w mask.
Black color from the mask should be replaced with the same part from over image.
White color from the mask should be replaced withthe same part from input image.
I'm trying to write equivalent code in Imagick.
Code: Select all
try {
$baseObj = new Imagick($input);
$overObj = new Imagick($overlay);
$maskObj = new Imagick($mask);
$maskObj->setImageColorspace(imagick::COLORSPACE_GRAY);
$baseObj->compositeImage($maskObj, Imagick::COMPOSITE_SCREEN, 0, 0);
$maskObj->negateImage(1);
if ($baseObj->getImageFormat() == 'GIF') {
$overObj->compositeImage($maskObj, Imagick::COMPOSITE_SCREEN, 0, 0);
}
$baseObj->compositeImage($overObj, Imagick::COMPOSITE_MULTIPLY, 0, 0);
$baseObj->writeImage($output);
$baseObj->destroy();
$maskObj->destroy();
$overObj->destroy();
}
catch(Exception $e) {
echo "Caught Imagick exception: " . $e->getMessage() . ".\n";
}
I use ImageMagick 6.7.9-4 Q8 and Imagick 3.1.0RC2 and RC1.
cheers
tk1
tk1
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: compose over
Yes, this is the Imagick forum and the correct place to ask your question. However, many of us know little about it as it was not developed by the Imagemagick team and we understand that it is no longer being maintained. Apart from the references I mentioned earlier, I know little about how to convert the command line into Imagick commands.
-combine puts individual grayscale images into the R,G,B channels to form one new image.
-composite takes two color images and mixes them together according to the compose method, of which the most common is over (overlaying one on the other).
Today you can use composite ... or the more flexible convert ... -compose ... -composite.
see
http://www.imagemagick.org/script/comma ... hp#combine
http://www.imagemagick.org/script/comma ... hp#compose
http://www.imagemagick.org/script/comma ... #composite
http://www.imagemagick.org/Usage/compose/
http://www.imagemagick.org/Usage/layers/
No, not to my knowledge. If that were the case, it was so long ago as not be usable now. -combine and -composite are two different beasts.Maybe I misunderstood, but combine.exe command was replaced with composite.exe. Am I right?
-combine puts individual grayscale images into the R,G,B channels to form one new image.
-composite takes two color images and mixes them together according to the compose method, of which the most common is over (overlaying one on the other).
Today you can use composite ... or the more flexible convert ... -compose ... -composite.
see
http://www.imagemagick.org/script/comma ... hp#combine
http://www.imagemagick.org/script/comma ... hp#compose
http://www.imagemagick.org/script/comma ... #composite
http://www.imagemagick.org/Usage/compose/
http://www.imagemagick.org/Usage/layers/
Re: compose over
I am not offended either tk1; I was just letting you know why there may not be the answers you want coming from the forum with regards to Imagick.