Page 1 of 1

MagickResizeImage and imagecreatetruecolor

Posted: 2009-06-02T10:34:25-07:00
by Carlos82
I want to integrate ImageMagick with GD, manipulating with MagickWand. How can I convert from ImageMagick to GD format?

$dst_img = imagecreatetruecolor($dst_width, $dst_height);


$magick_wand = NewMagickWand();

MagickReadImage( $magick_wand, $src_img );

MagickResizeImage( $magick_wand, $dst_width, $dst_height, MW_LanczosFilter, 1.0 );

$dst_img = $magick_wand; <----------- It fails here

Thanks.

Re: MagickResizeImage and imagecreatetruecolor

Posted: 2009-06-02T11:08:38-07:00
by magick
Looks like you'll need to write blob in a well-known format with GD (e.g. PNG) and then read it as a blob with MagickWand for PHP.

Re: MagickResizeImage and imagecreatetruecolor

Posted: 2009-06-02T12:10:35-07:00
by Carlos82
So if I read with GD, I must pass it to MagickWand reading as blob?

Read with GD:
$imagecreatefrom = 'imagecreatefrom' . $default_formats[$sizes[2]];
$src_img = @$imagecreatefrom($source)

Then read as blob:
$MagickReadImageBlob( $magick_wand, $src_img );

Process with MagickWand:
MagickResizeImage( $magick_wand, $dst_width, $dst_height, MW_LanczosFilter, 1.0 );

And then back to GD:
$dst_img = MagickGetImageBlob( $magick_wand );

It doesn't work.

Thanks.