php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #60830 Issue with getColor
Submitted: 2012-01-21 08:20 UTC Modified: 2017-10-24 06:33 UTC
From: fedora at famillecollet dot com Assigned:
Status: Open Package: gmagick (PECL)
PHP Version: 5.4.0RC6 OS: GNU/Linux (Fedora 16)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2012-01-21 08:20 UTC] fedora at famillecollet dot com
Description:
------------
GraphicsMagick accept a --with-quantum-depth which define the color representation

Default : 8, which means RGB value are in range [0..255]

Starting with fedora 16

Used : 16, which means RGB value are in range [0..65535] 

So there is 6 tests which fail, because getColor returns rgb(65535,65535,65535)
gmagick-025-set_and_getimageckgroundcolor
gmagick-027-set_getimagebordercolor
gmagick-054-getquantumdepth
gmagickdraw-006-setfillcolor_getfillcolor
gmagickdraw-013-setstrokecolor_getstrokecolor
gmagickpixel-001-setcolor_getcolor

I don't what is the good solution ?
- fix the test suite ?
- fix the getColor fonction to mimic the old behavior and still return [0..255] value ?

Of course, I could help, at least testing, or proposing a patch


Test script:
---------------
php -r '$color = "rgb(255,255,255)"; $pixel = new GmagickPixel($color); var_dump($pixel->getColor());'

Expected result:
----------------
string(16) "rgb(255,255,255)"


Actual result:
--------------
string(22) "rgb(65535,65535,65535)"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-22 19:39 UTC] rasmus@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: mkoppanen
 [2012-01-23 07:58 UTC] fedora at famillecollet dot com
Well, after some thinking: this extension is a wrapper, so should keep the standard library behavior.

Yes, having setColor using [0..255] and getColor retrieving [0..65535] is ugly (but its the GM upstream choice)

First patch proposal for gmagick-054-getquantumdepth.phpt
https://raw.github.com/remicollet/remirepo/43d4626670f5edb1d36c01ce5d66ccab76d7b350/php-pecl-gmagick/gmagick-tests.patch
 [2013-10-19 09:28 UTC] vito@php.net
Automatic comment from SVN on behalf of vito
Revision: http://svn.php.net/viewvc/?view=revision&revision=331865
Log: #60830 Updated test for getQuantumDepth
 [2013-10-19 09:43 UTC] vito@php.net
-Status: Assigned +Status: Closed
 [2013-10-19 09:43 UTC] vito@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 [2013-10-20 10:59 UTC] remi@php.net
-Status: Closed +Status: Re-Opened
 [2013-10-20 10:59 UTC] remi@php.net
Please keep this one open.
The path only fix gmagick-054-getquantumdepth.phpt

Still fail:
tests/gmagick-025-set_and_getimageckgroundcolor.phpt
tests/gmagick-027-set_getimagebordercolor.phpt
tests/gmagickdraw-006-setfillcolor_getfillcolor.phpt
tests/gmagickdraw-013-setstrokecolor_getstrokecolor.phpt
tests/gmagickpixel-001-setcolor_getcolor.phpt
 [2017-10-24 05:17 UTC] kalle@php.net
-Status: Re-Opened +Status: Assigned
 [2017-10-24 06:33 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: mkoppanen +Assigned To:
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Feb 20 21:01:25 2019 UTC