bug in imshow for PDF, EPS output

Hi all,

I've come across an apparent bug in imshow when outputting to PDF and EPS files. (I haven't tested other vector formats.) It manifests as a small scaling error between the raster image and the axes coordinates.

I have attached a test script to illustrate the problem. The (correct) PNG output file shows a green 'X' at the common point between four pixels near the center of the raster image. The extent is chosen such that the coordinates refer to pixel centers. The PDF and EPS output files show a misalignment between the X and the pixel boundaries -- zoom in to see it clearly. Also, the topmost row and rightmost column appear truncated.

I am using svn r7395.

Thanks for the attention,
Mike

test_image_offset.py (601 Bytes)

I've added this to the sourceforge bug tracker, ID 2832896.

Mike

···

On Aug 5, 2009, at 3:32 PM, Michael Fitzgerald wrote:

Hi all,

I've come across an apparent bug in imshow when outputting to PDF and EPS files. (I haven't tested other vector formats.) It manifests as a small scaling error between the raster image and the axes coordinates.

I have attached a test script to illustrate the problem. The (correct) PNG output file shows a green 'X' at the common point between four pixels near the center of the raster image. The extent is chosen such that the coordinates refer to pixel centers. The PDF and EPS output files show a misalignment between the X and the pixel boundaries -- zoom in to see it clearly. Also, the topmost row and rightmost column appear truncated.

I am using svn r7395.

Thanks for the attention,
Mike

<test_image_offset.py>

Hi all,

Has anybody been able to confirm this as a bug? The test script is
attached to the tracker item:
https://sourceforge.net/tracker/?func=detail&aid=2832896&group_id=80706&atid=560720

I did some digging to see if I could figure out how the image scale
was being mangled. I had a hunch that it was due to some interaction
between fixed-72-dpi code, rounding the number of pixels, and
subsequent rescaling. However, the image scale still seems to be off
even when the dpi setting is a multiple of 72.

Mike

···

On Aug 6, 2009, at 10:42 AM, Michael Fitzgerald wrote:

I've added this to the sourceforge bug tracker, ID 2832896.

Mike

On Aug 5, 2009, at 3:32 PM, Michael Fitzgerald wrote:

Hi all,

I've come across an apparent bug in imshow when outputting to PDF and EPS files. (I haven't tested other vector formats.) It manifests as a small scaling error between the raster image and the axes coordinates.

I have attached a test script to illustrate the problem. The (correct) PNG output file shows a green 'X' at the common point between four pixels near the center of the raster image. The extent is chosen such that the coordinates refer to pixel centers. The PDF and EPS output files show a misalignment between the X and the pixel boundaries -- zoom in to see it clearly. Also, the topmost row and rightmost column appear truncated.

I am using svn r7395.

Thanks for the attention,
Mike

<test_image_offset.py>