Page 1 of 1

Problem after update

Posted: 2009-10-06T11:09:17-07:00
by dsl
Hello, guys.

Please, help me to understand where the problem is.
The problem arised after I've upgraded IM from 6.4.5 to 6.5.6-7.
After that white rectangle appeared on the gif below.

Image

Original image

Image

Here is script which I use to generate this movie.

Code: Select all

#!/usr/bin/perl

use strict;
use Image::Magick;

my $img_orig = Image::Magick->new();;
$img_orig->Read( 'original.jpg' );

my $img = Image::Magick->new( size => $img_orig->Get('width').'x'.$img_orig->Get('height') );
$img->Set( page => $img_orig->Get('width').'x'.$img_orig->Get('height') );
my $maxi = 5;
for(my $i=0; $i<$maxi; $i++){ $img->Read( 'xc:white' ); }

my ($w,$h)  = $img->Get('width','height');

my $img_tmp1 = $img_orig->Clone();
$img_tmp1->Crop( width => int($w/2), height => int($h/2), x => 0, y => 0);
my $img_tmp2 = $img_orig->Clone();
$img_tmp2->Crop( width => int($w/2), height => int($h/2), x => int($w/2), y => 0);
my $img_tmp3 = $img_orig->Clone();
$img_tmp3->Crop( width => int($w/2), height => int($h/2), x => int($w/2), y => int($h/2));
my $img_tmp4 = $img_orig->Clone();
$img_tmp4->Crop( width => int($w/2), height => int($h/2), x => 0, y => int($h/2));

$img->[0] = $img_orig->Clone();

$img->[0]->Set( 'delay' => 120 );
$img->[1]->Set( 'delay' => 30 );
$img->[2]->Set( 'delay' => 30 );
$img->[3]->Set( 'delay' => 30 );
$img->[4]->Set( 'delay' => 30 );

my $koef = $w > $h ? $w*0.02 : $h*0.02;

$img->[1]->Composite( image => $img_tmp1, geometry => '+'.int($w/2 + $koef).'-'.$koef );
$img->[1]->Composite( image => $img_tmp2, geometry => '+'.int($w/2 + $koef).'+'.int($h/2+$koef) );
$img->[1]->Composite( image => $img_tmp3, geometry => '-'.$koef.'+'.int($h/2+$koef) );
$img->[1]->Composite( image => $img_tmp4, geometry => '-'.$koef.'-'.$koef );

$img->[2]->Composite( image => $img_tmp1, geometry => '+'.int($w/2 + $koef).'+'.int($h/2+$koef) );
$img->[2]->Composite( image => $img_tmp2, geometry => '-'.$koef.'+'.int($h/2+$koef) );
$img->[2]->Composite( image => $img_tmp3, geometry => '-'.$koef.'-'.$koef );
$img->[2]->Composite( image => $img_tmp4, geometry => '+'.int($w/2 + $koef).'-'.$koef );

$img->[3]->Composite( image => $img_tmp1, geometry => '-'.$koef.'+'.int($h/2+$koef) );
$img->[3]->Composite( image => $img_tmp2, geometry => '-'.$koef.'-'.$koef );
$img->[3]->Composite( image => $img_tmp3, geometry => '+'.int($w/2 + $koef).'-'.$koef );
$img->[3]->Composite( image => $img_tmp4, geometry => '+'.int($w/2 + $koef).'+'.int($h/2+$koef) );

$img->[4]->Composite( image => $img_tmp1, geometry => '-'.$koef.'-'.$koef );
$img->[4]->Composite( image => $img_tmp2, geometry => '+'.int($w/2 + $koef).'-'.$koef );
$img->[4]->Composite( image => $img_tmp3, geometry => '+'.int($w/2 + $koef).'+'.int($h/2+$koef) );
$img->[4]->Composite( image => $img_tmp4, geometry => '-'.$koef.'+'.int($h/2+$koef) );

print "here we go\n";
$img->Write('movie.gif');

Re: Problem after update

Posted: 2009-10-06T11:42:20-07:00
by magick
Grab ImageMagick 6.5.6-9. There was a patch to the composite methods. See if that fixes your problem. If not, we'll investigate further.

Re: Problem after update

Posted: 2009-10-06T12:27:07-07:00
by dsl
Thanks for the prompt response!
I've just upgrated to 6.5.6-9. The problem remained :(

Re: Problem after update

Posted: 2009-10-06T15:15:37-07:00
by fmw42
I don't read perl well, but after a crop don't you need a +repage to remove the virtual canvas? Is there such a command in perlmagick?

also would it not be easier to use -gravity northwest, northeast, southwest and southeast in your composites rather than -geometry?

Re: Problem after update

Posted: 2009-10-06T15:57:31-07:00
by magick
We can reproduce the problem and have a patch. Look for it in ImageMagick 6.5.6-10 Beta by sometime tomorrow.

Re: Problem after update

Posted: 2009-10-07T23:42:38-07:00
by dsl
Sorry guys, but still nothing. 6.5.6-9 is the latest available release.