php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56134 imagick_transformrgb does not work with ImageMagick 5.5.7
Submitted: 2004-07-16 05:25 UTC Modified: 2013-12-03 11:38 UTC
From: k at ailis dot de Assigned:
Status: Not a bug Package: imagick (PECL)
PHP Version: 4.3.3 OS: Debian GNU/Linux 3.0
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: k at ailis dot de
New email:
PHP Version: OS:

 

 [2004-07-16 05:25 UTC] k at ailis dot de
Description:
------------
The imagick_transformrgb function is not working with ImageMagick (at least not with 5.5.7). If I want to convert a CMYK JPEG into RGB it simply does nothing. The result is still a CMYK JPEG. But with GraphicsMagick (1.1.2) it works.

Instead ImageMagick's SetImageColorSpace function works so it may be useful to switch to this function. But this function does not work with GraphicsMagick 1.1.2 (Compiles fine but results in a segfault). So a compiler switch may be needed.

SetImageColorSpace has exactly the same syntax as the TransformRGB function.

I'm not fit enough in API issues of ImageMagick/GraphicsMagick so I have no idea if it is a good thing to have a imagick_transformrgb() function which calls the ImageMagick's SetImageColorSpace function. Maybe it's better to have a imagick_setcolorspace function (which would be intuitiv because there is already an imagick_getcolorspace function).

Reproduce code:
---------------
$handle = imagick_readimage('cmyk.jpeg');

imagick_transformrgb($handle, IMAGICK_COLORSPACE_RGB);

imagick_writeimage($handle, 'rgb.jpeg');


Expected result:
----------------
A rgb.jpeg with RGB colorspace

Actual result:
--------------
A rgb.jpeg with untouched CMYK colorspace

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-12-30 16:56 UTC] bondu at iowalab dot com
Perlmagick has the same problem:
http://studio.imagemagick.org/pipermail/magick-bugs/2003-March/001134.html

Adding a method for imagemagick's Transformcolorspace should fix this.   The sentax is the same as TransformRGBImage

something like:
PHP_FUNCTION( imagick_transformcolorspace )
{
        zval*      handle_id ;          /* the handle identifier coming from
                                           the PHP environment */
        long       colorspace ;         /* the colorspace to transform the
                                           image to */
        imagick_t* handle ;             /* the actual imagick_t struct for the
                                           handle */
                                                                                                                                             
        if ( zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "rl",
                        &handle_id, &colorspace ) == FAILURE )
        {
                return ;
        }
                                                                                                                                             
        handle = _php_imagick_get_handle_struct_from_list( &handle_id TSRMLS_CC ) ;
        if ( !handle )
        {
                php_error( E_WARNING, "%s(): handle is invalid",
                           get_active_function_name( TSRMLS_C ) ) ;
                RETURN_FALSE ;
        }
                                                                                                                                             
        _php_imagick_clear_errors( handle ) ;
                                                                                                                                             
        TransformColorspace( handle->image, ( ColorspaceType )colorspace ) ;
        if ( _php_imagick_is_error( handle ) )
        {
                RETURN_FALSE ;
        }
                                                                                                                                             
        RETURN_TRUE ;
}
 [2013-12-03 11:38 UTC] mike@php.net
-Status: Open +Status: Not a bug
 [2013-12-03 11:38 UTC] mike@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 08:01:28 2024 UTC