php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #70802 Confusing alpha values in help
Submitted: 2015-10-27 16:20 UTC Modified: 2017-01-28 19:17 UTC
From: chris at ocproducts dot com Assigned:
Status: Open Package: GD related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: chris at ocproducts dot com
New email:
PHP Version: OS:

 

 [2015-10-27 16:20 UTC] chris at ocproducts dot com
Description:
------------
---
From manual page: http://www.php.net/function.imagecolorat
---

The imagecolorsforindex example embedded within the imagecolorat documentation shows output with alpha of 127.

PHP alpha is inverted from what people normally expect, so people will think 127 is either fully opaque or 50% opaque (depending how knowledgable they are).

In-fact, 127 is 0% opaque, i.e. 100% transparent.

The user is very likely to be confused/misled, as:
a) an example showing a fully transparent pixel is not what they'd assume
b) it is not otherwise mentioned that this example if of a transparent pixel
c) as the RGB components have actual values, a typical user is really going to not expect this, as they don't imagine transparent pixels with RGB values (again, a typical user, not an expert)

If you look at the example on the imagecolorsforindex function page it uses a more normal example.

I suggest the imagecolorat be given an alpha example with 0.


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-28 17:37 UTC] cmb@php.net
-Package: Documentation problem +Package: GD related
 [2017-01-28 19:17 UTC] cmb@php.net
Related to bug #67900.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 10 09:01:26 2024 UTC