Thanks Peter.  This was, in fact, the problem.  I changed to .PNG output and things are fine.  Searching for a solution that allows for writing TIFF format I found that the following will work:
  vil_image_view<PixelType> cropped_image = vil_crop(img_in, 56, 128, 136, 128);
  vil_image_view<PixelType> cropped_copy;
  vil_save(cropped_copy, ofname().c_str() );
Not elegant, but it does work.
Glen Brooksby

From: Peter Carr []
Sent: Thursday, May 15, 2008 7:18 PM
To: Brooksby, Glen W (GE, Research)
Subject: Re: [Vxl-users] Vil_crop problem

I believe it's related to the format specific vil_save implementation and not vil_crop.  I had similar problems saving using TIFF.  Switching to PNG solved the problem.  For what it's worth, you should find corresponding pixels in your two cropped vil_image_views to be identical (i.e., vil_crop works correctly).  It looks like the TIFF adaptor ignores any offset on the top left pointer.


On 16/05/2008, at 7:48 AM, Brooksby, Glen W (GE, Research) wrote:

Has anyone noticed odd behaviour with vil_crop()?

I'm noticing that in a very simple program the followning lines of code produce the same output image:

  vil_image_view<PixelType> cropped_image = vil_crop(img_in, 0, 128, 0, 128);
  vil_save(cropped_image, ofname().c_str() );


  vil_image_view<PixelType> cropped_image = vil_crop(img_in, 56, 128, 136, 128);
  vil_save(cropped_image, ofname().c_str() );

The result for either pair of lines give the same output image.  The output image begins at i0=j0=0 in the original image and is 128x128.  It's as if i0 and j0 are ignored.  Has anyone else seen this behavior?

Glen Brooksby