|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #71524 Produces only black image
Submitted: 2016-02-04 18:22 UTC Modified: 2016-02-07 02:15 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: lee dot traynor at skeptic dot de Assigned: danack (profile)
Status: Assigned Package: imagick (PECL)
PHP Version: 5.5.32 OS: Windows XP/7/8/10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
28 - 3 = ?
Subscribe to this entry?

 [2016-02-04 18:22 UTC] lee dot traynor at skeptic dot de
From manual page:
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 

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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-05 20:56 UTC]
-Assigned To: +Assigned To: danack
 [2016-02-05 20:56 UTC]
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-05 21:05 UTC] 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-06 12:53 UTC]
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-06 18:43 UTC] lee dot traynor at skeptic dot de
-Type: Bug +Type: Documentation Problem
 [2016-02-06 18:43 UTC] lee dot traynor at skeptic dot de
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
 [2016-02-07 02:15 UTC]
> Finally why in a lot of the Imagick examples is Imagick written with a backslash in front of it?

The 'Imagick' class exists in the global namespace. When used in a different namespace, you either need to do "use Imagick;" at the top of the file, or use `\Imagick` to escape from that namespace to the global one.

It seems I prefer to use slashes for classes for this case.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Jun 16 12:01:28 2024 UTC