finaly I did it this way : (pasted at the end of the mail) But the problem is the result is very dirty, considering the result with other way to do this.
top-left is the image in XPM-format top-right is the image in PNG-format bottom-left is a classic php-gtk-script displaying an XPM image bottom-right is the php-script below loading and displaying a PNG img Why is the result so bad ? ======================================= <?php if ( !extension_loaded( 'gtk' ) ) strstr( PHP_OS, 'Linux' ) ? dl('php_gtk.so') : dl('php_gtk.dll'); $handle = imagick_readimage( 'images/img.1.png' ); if ( imagick_iserror( $handle ) ) { $reason = imagick_failedreason( $handle ); $description = imagick_faileddescription( $handle ); print "handle failed!\nReason: $reason\nDescription: $description\n"; exit; } imagick_convert( $handle, 'XPM' ); if ( !( $image_data = imagick_image2blob( $handle ) ) ) { $reason = imagick_failedreason( $handle ); $description = imagick_faileddescription( $handle ); print "imagick_image2blob() failed\nReason: $reason\nDescription: $description\n"; exit; } $head = '!/\*\s*XPM\s*\*/\s*static\s*char\s*\*\[\]\s*=\s*{\s*/\*\s*columns rows colors chars-per-pixel\s*\*/\s*!'; $image_data = preg_replace( $head, '', $image_data ); $image_data = preg_replace( '!/\*\s*pixels\s*\*/\s*!m', '', $image_data ); $image_data = preg_replace( '!"\s*};\s*$!', '', $image_data ); $image_data = preg_replace( '!(^"|",$)!m', '', $image_data ); $image_data = explode( "\n", $image_data ); $win = &new GtkWindow(); $win->connect( 'destroy', create_function( '', 'Gtk::main_quit();' ) ); $win->set_usize( 256, 256 ); $win->realize(); $transp = &new GdkColor( 1, 0, 0 ); list( $pixmap, $mask ) = Gdk::pixmap_create_from_xpm_d( $win->window, $transp, $image_data ); $image = &new GtkPixmap( $pixmap, $mask ); $box = &new GtkVbox(); $box->add( $image ); $win->add( $box ); $win->show_all(); Gtk::main(); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php