php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #76179 image2wbmp: missing default value and documentation for threshold argument
Submitted: 2018-04-03 10:42 UTC Modified: 2018-10-06 14:31 UTC
From: php4fan at gmail dot com Assigned: cmb (profile)
Status: Duplicate Package: GD related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2018-04-03 10:42 UTC] php4fan at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.image2wbmp
---

> bool image2wbmp ( resource $image [, string $filename [, int $threshold ]] )

> threshold
>  Threshold value, between 0 and 255 (inclusive).

First and most important: what the f*** is the default value if none is given as argument?? The default value for an argument should never be left undocumented.

Then, there is no explanation whatsoever of how the threshold works at all (or what it is to start with). My educated guess is that it must be the threshold of brightness above which a pixel will be converted to white and below which it will be converted to black. However, the first non-obvious information that is missing is: what about pixels that have the exact value of the threshold? That is, will it be white if >threshold or if >=threshold?

Another non obvious thing is how the threshold works for color images (as opposed to greyscale). Probably the brightness will be computed and then compared to the threshold. But what is the exact function used to compute the brightness from the RGB values?




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-04-03 11:55 UTC] cmb@php.net
-Package: Documentation problem +Package: GD related
 [2018-04-03 11:55 UTC] cmb@php.net
Unfortunately, there is bug #73317, so image2wbmp() still is
useless.

By the way, do you really want to create WBMP images?
 [2018-10-06 14:31 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2018-10-06 14:31 UTC] cmb@php.net
Since the mentioned bug report has been resolved as documentation
problem, this ticket is merely a duplicate.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Nov 25 21:01:33 2024 UTC