php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75802 Missing the sGray
Submitted: 2018-01-11 14:07 UTC Modified: 2018-11-29 03:21 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: pascal dot christen at hostpoint dot ch Assigned:
Status: Not a bug Package: imagick (PECL)
PHP Version: Irrelevant OS: FreeBSD
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pascal dot christen at hostpoint dot ch
New email:
PHP Version: OS:

 

 [2018-01-11 14:07 UTC] pascal dot christen at hostpoint dot ch
Description:
------------
ImageMagick introduced the LinearGray colorspace (sGray) in 6.9.9-28+ and 7.0.7-16+ (http://www.imagemagick.org/discourse-server/viewtopic.php?f=4&t=33265)


sGray CONST didnt get implemented till now in imagick.


Test script:
---------------
identify -verbose image.png | grep -E 'Version|Colorspace'
  Colorspace: sGray
  Version: ImageMagick 6.9.9-28 Q16 amd64 2017-12-27 http://www.imagemagick.org


<?php
$im = new Imagick('image.png');
$color = $im->getImageColorspace();

//Return of getImageColorspace(Integer)
echo $color;


//Print all available Colorspaces
$reflection = new \ReflectionClass("\Imagick");
$colorspaces = array_flip(
    array_filter(
        $reflection->getConstants(),
        function ($k) {
            return mb_strpos($k, "COLORSPACE") !== false;
        },
        ARRAY_FILTER_USE_KEY
    )
); 
print_r($colorspaces);
?>

Expected result:
----------------
Prints out:
35

Array ( [0] => COLORSPACE_UNDEFINED [1] => COLORSPACE_RGB [2] => COLORSPACE_GRAY [3] => COLORSPACE_TRANSPARENT [4] => COLORSPACE_OHTA [5] => COLORSPACE_LAB [6] => COLORSPACE_XYZ [7] => COLORSPACE_YCBCR [8] => COLORSPACE_YCC [9] => COLORSPACE_YIQ [10] => COLORSPACE_YPBPR [11] => COLORSPACE_YUV [12] => COLORSPACE_CMYK [13] => COLORSPACE_SRGB [14] => COLORSPACE_HSB [15] => COLORSPACE_HSL [16] => COLORSPACE_HWB [17] => COLORSPACE_REC601LUMA [19] => COLORSPACE_REC709LUMA [21] => COLORSPACE_LOG [22] => COLORSPACE_CMY [23] => COLORSPACE_LUV [24] => COLORSPACE_HCL [25] => COLORSPACE_LCH [26] => COLORSPACE_LMS [27] => COLORSPACE_LCHAB [28] => COLORSPACE_LCHUV [29] => COLORSPACE_SCRGB [30] => COLORSPACE_HSI [31] => COLORSPACE_HSV [32] => COLORSPACE_HCLP [33] => COLORSPACE_YDBDR [18] => COLORSPACE_REC601YCBCR [20] => COLORSPACE_REC709YCBCR [34] => COLORSPACE_XYY [35] => COLORSPACE_SGRAY )

Actual result:
--------------
Prints out:
35

Array ( [0] => COLORSPACE_UNDEFINED [1] => COLORSPACE_RGB [2] => COLORSPACE_GRAY [3] => COLORSPACE_TRANSPARENT [4] => COLORSPACE_OHTA [5] => COLORSPACE_LAB [6] => COLORSPACE_XYZ [7] => COLORSPACE_YCBCR [8] => COLORSPACE_YCC [9] => COLORSPACE_YIQ [10] => COLORSPACE_YPBPR [11] => COLORSPACE_YUV [12] => COLORSPACE_CMYK [13] => COLORSPACE_SRGB [14] => COLORSPACE_HSB [15] => COLORSPACE_HSL [16] => COLORSPACE_HWB [17] => COLORSPACE_REC601LUMA [19] => COLORSPACE_REC709LUMA [21] => COLORSPACE_LOG [22] => COLORSPACE_CMY [23] => COLORSPACE_LUV [24] => COLORSPACE_HCL [25] => COLORSPACE_LCH [26] => COLORSPACE_LMS [27] => COLORSPACE_LCHAB [28] => COLORSPACE_LCHUV [29] => COLORSPACE_SCRGB [30] => COLORSPACE_HSI [31] => COLORSPACE_HSV [32] => COLORSPACE_HCLP [33] => COLORSPACE_YDBDR [18] => COLORSPACE_REC601YCBCR [20] => COLORSPACE_REC709YCBCR [34] => COLORSPACE_XYY ) 

Patches

patch-sgray.diff (last revision 2018-01-11 15:09 UTC by pascal dot christen at hostpoint dot ch)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-11-29 03:21 UTC] danack@php.net
-Status: Open +Status: Not a bug
 [2018-11-29 03:21 UTC] danack@php.net
Apparently sGray got added......and then got removed again.

There will be the LinearGRAYColorspace added in the next version of Imagick, which I believe is what the sGray ended up being called.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 12:01:33 2025 UTC