Bug->Doc #71524 [Asn]: Produces only black image
| From: | lee dot traynor at skeptic dot de | Date: | Sat, 06 Feb 2016 18:43:22 +0000 |
| Subject: | Bug->Doc #71524 [Asn]: Produces only black image | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-13167@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71524&edit=1
ID: 71524
User updated by: lee dot traynor at skeptic dot de
Reported by: lee dot traynor at skeptic dot de
Summary: Produces only black image
Status: Assigned
-Type: Bug
+Type: Documentation Problem
Package: imagick
Operating System: Windows XP/7/8/10
PHP Version: 5.5.32
Assigned To: danack
Block user comment: N
Private report: N
New Comment:
That seems to work fine as in this script to emulate grain extract layer mode:
$im = new Imagick (realpath ("Paihia_Sunset.jpg"));
$ge = clone $im;
$ge->modulateImage (100, 0, 100);
$ge->blurImage (0, 15);
$ge->setImageArtifact ("compose:args", "0,-1,1,0.5");
$im->compositeImage ($ge, Imagick::COMPOSITE_MATHEMATICS, 0, 0);
Note that the two values in the middle apply to $ge (-1) and $im (+1) respectively. This is
difficult to see from the imagemagick command line because the images have to be swapped.
If you were correcting the documentation, then the line about the virtual pixels can be removed.
Perhaps that will make it clearer that the artifact has to be set on the composited object.
Finally why in a lot of the Imagick examples is Imagick written with a backslash in front of it?
I've never found it necessary to escape "i" and "\i" has no particular
significance. It just makes the examples harder to follow.
Best, Lee
Previous Comments:
------------------------------------------------------------------------
[2016-02-06 12:53:22] danack@php.net
I think setting the compose:args on the second image, gives the expected result:
$im2->setImageArtifact ("compose:args", "1,0,-0.5,0.5");
Can you confirm?
------------------------------------------------------------------------
[2016-02-05 21:05:05] lee dot traynor at skeptic dot de
The command as given on the man page:
convert src1.png src2.png -compose mathematics -define compose:args="1,0,-0.5,0.5"
-composite output.png
works perfectly well with said version of Imagemagick (using two identical images, a somewhat
brighter but greyed out image is obtained).
------------------------------------------------------------------------
[2016-02-05 20:56:39] danack@php.net
Could you do me a favour and give the equivalent
convert command?
this is going to be an issue that I'll need to report upstream to the ImageMagick guys.
------------------------------------------------------------------------
[2016-02-04 18:22:37] lee dot traynor at skeptic dot de
Description:
------------
---
From manual page: http://www.php.net/imagick.compositeimage
---
The script produces only black images regardless of the values passed by setImageArtifact.
imagick module version 3.4.0RC6
Imagick compiled with ImageMagick version ImageMagick 6.8.9-1 Q16 x86 2014-05-08 http://www.imagemagick.org
Test script:
---------------
$im1 = new Imagick (realpath ("Waikare.jpg"));
$im2 = clone $im1;
$im1->setImageVirtualPixelMethod (Imagick::VIRTUALPIXELMETHOD_TRANSPARENT);
$im1->setImageArtifact ("compose:args", "1,0,-0.5,0.5");
$im1->compositeImage ($im2, Imagick::COMPOSITE_MATHEMATICS, 0, 0);
$im1->writeImage (getcwd () . "/test.png");
echo "<img src=\"test.png\">";
Expected result:
----------------
Using the values 0,1,-1,0.5 a grey image should be produced.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71524&edit=1