Magickwand iterator not working!!!
Posted: 2007-09-24T09:55:23-07:00
Hey,
I am trying to do an image montage using MagickMontageImage with a set of images. However I noticed that montage is working fine in Windows and not working in my development server which is Fedora Core 5. By not working I mean the images are stitched together but it is always 2 images irrespective of the input. I tried with 7 images and got an output with 2 images stitched.
So I did some more work on this by iterating the images in Magickwand and found that there were only 2 images in the sequence.
This is the output I got.
My ImageMagick version is ImageMagick 6.2.5
Could someone please tell me what I am doing wrong here!
Thanks
Jugs
I am trying to do an image montage using MagickMontageImage with a set of images. However I noticed that montage is working fine in Windows and not working in my development server which is Fedora Core 5. By not working I mean the images are stitched together but it is always 2 images irrespective of the input. I tried with 7 images and got an output with 2 images stitched.
So I did some more work on this by iterating the images in Magickwand and found that there were only 2 images in the sequence.
Code: Select all
function create_montage($filenames, $output_path){
$mgk = NewMagickWand();
$drw = NewDrawingWand();
$width = 0;
$height=0;
$count = 0;
foreach( $filenames as $filename){
$b1 = MagickReadImage($mgk, $filename);
echo $filename . " = " . $b1 . "<BR>";
}
MagickResetIterator( $mgk );
while( MagickHasNextImage( $mgk ) ){
MagickNextImage( $mgk );
echo MagickGetImageFilename($mgk) . "<BR>";
}
}
$images = Array();
$images[0] = '/tmp/88271534_db6281aa48_m.jpg';
$images[1] = '/tmp/820561_3374efc3e9_m.jpg';
$images[2] = '/tmp/820567_68d076197c_m.jpg';
$images[3] = '/tmp/88271534_db6281aa48_m.jpg';
$images[4] = '/tmp/OdYr08nCrQrE_1190597124.jpg';
$images[5] = '/tmp/337213047_9faebc2b67_m.jpg';
$images[6] = '/tmp/348902357_6f52336f3f_m.jpg';
create_montage($images,'/tmp/output.jpg');
This is the output I got.
Code: Select all
/tmp/88271534_db6281aa48_m.jpg = 1
/tmp/820561_3374efc3e9_m.jpg = 1
/tmp/820567_68d076197c_m.jpg = 1
/tmp/88271534_db6281aa48_m.jpg = 1
/tmp/OdYr08nCrQrE_1190597124.jpg = 1
/tmp/337213047_9faebc2b67_m.jpg = 1
/tmp/348902357_6f52336f3f_m.jpg = 1
/tmp/820561_3374efc3e9_m.jpg
/tmp/88271534_db6281aa48_m.jpg
Could someone please tell me what I am doing wrong here!
Thanks
Jugs