bug in -distort Barrel
Posted: 2010-03-27T16:13:52-07:00
The documentation says that the fourth argument is optional and will be computed if it is missing, but if only 3 arguments are specified to barrel distortion, IM prints an error message.
In distort.c at line 1237 is this code:
The first if statement causes an error if there aren't 4, 6, 8, or 10 arguments. But the next if statement tests for the case where there are 3 or 5 arguments and, if so, computes the missing value.
The first if statement should allow the number of arguments to be 3,4,5,6,8 or 10.
Pete
In distort.c at line 1237 is this code:
Code: Select all
if ( number_arguments != 4 && number_arguments != 6 &&
number_arguments != 8 && number_arguments != 10 ) {
coeff=(double *) RelinquishMagickMemory(coeff);
(void) ThrowMagickException(exception,GetMagickModule(),OptionError,
"InvalidArgument", "%s : '%s'", "Barrel(Inv)",
"number of arguments" );
return((double *) NULL);
}
/* A,B,C,D coefficients */
coeff[0] = arguments[0];
coeff[1] = arguments[1];
coeff[2] = arguments[2];
if ( number_arguments == 3 || number_arguments == 5 )
coeff[3] = 1 - arguments[0] - arguments[1] - arguments[2];
else
coeff[3] = arguments[3];
The first if statement should allow the number of arguments to be 3,4,5,6,8 or 10.
Pete