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 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:
MUST BE VALID
Solve the problem:
49 + 49 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2019 The PHP Group
All rights reserved.
Last updated: Sat Jun 15 20:01:27 2019 UTC