-affine sometimes produces output with missing rows
Swiss army knife of image processing
Brought to you by:
bfriesen
There's a bug in magick/render.c:
edge.y2 is a float. If it is between the value (image->rows-1 + 0.5) and (image->rows - epsilon), then this faulty condition will evaluate to false. One too many rows will be generated and a failure will be triggered for the last row.
if (edge.y2 >= image->rows)
edge.y2=image->rows-1;
y_max will be equal to image->rows.
y_max=(long) floor(edge.y2+0.5);
GetImagePixelsEx will fail because y == image->rows.
q=GetImagePixelsEx(image,x,y,stop-x+1,1,&image->exception);
if (q == (PixelPacket *) NULL)
thread_status=MagickFail;
~~~~~
The global status will be set to MagickFail and if OpenMP is enabled, then rows in the middle of the destination image will be skipped if the last row is evaluated before them. If OpenMP is disabled, the rows will be evaluated in order and since it's the very last row that triggers the failure, no defect will be visible.
The following change should be made.
Same with x:
Thanks for the analysis and the fix. The fix is checked into Mercurial and will appear in the next development snapshot.