#1889 imagick_transformrgb does not work with ImageMagick 5.5.7
Submitted: 2004-07-16 09:25 UTC
From: k at ailis dot de Assigned:
Status: Open Package:
PHP Version: 4.3.3 OS: Debian GNU/Linux 3.0
Roadmaps: (Not assigned)    
Subscription  


 [2004-07-16 09: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

Comments

 [2004-12-30 21: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 ; }