php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #71456 Requst for evaluate-sequence function
Submitted: 2016-01-26 13:51 UTC Modified: 2016-01-30 20:31 UTC
From: lee dot traynor at skeptic dot de Assigned: danack (profile)
Status: Closed Package: imagick (PECL)
PHP Version: 7.0.2 OS: Windows 7/8/10
Private report: No CVE-ID: None
 [2016-01-26 13:51 UTC] lee dot traynor at skeptic dot de
Description:
------------
---
From manual page: http://www.php.net/imagick.evaluateimage
---
Imagemagick's -evaluate-sequence operator takes a sequence of images, applies various statistical functions (mean, maximum, minimum, median) to them and returns a new image with those values. The documentation says it will take all the arguments that -evaluate takes, but that does not make any sense.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-27 23:34 UTC] danack@php.net
-Status: Open +Status: Feedback
 [2016-01-27 23:34 UTC] danack@php.net
Please can you clarify what this bug report is trying to say.

The words you have posted do not come from the manual page.

There is an example of how to use the evaluateImage image function here: http://phpimagick.com/Imagick/evaluateImage
 [2016-01-28 15:26 UTC] lee dot traynor at skeptic dot de
-Status: Feedback +Status: Open
 [2016-01-28 15:26 UTC] lee dot traynor at skeptic dot de
I am requesting a new function that does what this imagemagick command does:

convert *.jpg -evaluate-sequence median median.jpg

which is not the same as imagick's evaluateImage ().

Perhaps it is hidden away somewhere in development?
 [2016-01-28 22:56 UTC] danack@php.net
-Assigned To: +Assigned To: danack
 [2016-01-28 22:56 UTC] danack@php.net
>Perhaps it is hidden away somewhere

Is actually is. It's not listed as a usable function on the top of the page of: http://www.imagemagick.org/api/magick-image.php which is where I normally look, but it is listed inside the evaluateImage image function as:

MagickBooleanType MagickEvaluateImages(MagickWand *wand, const MagickEvaluateOperator operator)

It should be easy enough to add......
 [2016-01-29 10:07 UTC] lee dot traynor at skeptic dot de
From the context it looks like
"MagickBooleanType MagickEvaluateImages(MagickWand *wand, const MagickEvaluateOperator operator)"

will simply apply the -evaluate operator to a series of images.

The -evaluate-sequence operator does something different. It takes a series of images and calculates the mean, max, min or median of each pixel to produce the final image. -Evaluate takes all the pixels of one image and transforms the whole image accordingly.

To incorporate -evaluate-sequence might require a new function.
 [2016-01-30 02:18 UTC] danack@php.net
-Status: Assigned +Status: Feedback
 [2016-01-30 02:18 UTC] danack@php.net
I've added a function `Imagick::evaluateImages(int EVALUATE_CONSTANT) : Imagick`. 

Although the manual is not written clearly, I'm pretty certain that MagickEvaluateImages is the same function called as -evaluate-sequence  - please give it a try to see if it's working as expected.

https://pecl.php.net/package-changelog.php?package=imagick&release=3.4.0RC6
 [2016-01-30 20:31 UTC] lee dot traynor at skeptic dot de
-Status: Feedback +Status: Closed
 [2016-01-30 20:31 UTC] lee dot traynor at skeptic dot de
Thanks. The new function evaluateImages works very similarly to -evaluate-sequence and takes the EVALUATE_ constants. The following code has been tested with a couple of the constants to give identical results to imagemagick on the command line:

$im = new Imagick (realpath ("Waikare_E.jpg"));
$im->addImage (new Imagick (realpath ("Waikare_O.jpg")));
$im = $im->evaluateImages (imagick::EVALUATE_MAX);
$im->writeImage (getcwd (). "/test.jpg");
echo "<img src=\"test.jpg\">";
// compare with convert waikare_*.jpg -evaluate-sequence max evalseqtest.jpg

Still, don't know why anyone would use the log, power, sine or cosine constants, but I suppose that's imagemagick's problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 15 10:01:31 2024 UTC