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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: php4fan at gmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Tue Sep 17 23:01:27 2019 UTC