I used Excel to create an editor that looks like this:

editor.jpg

When users click "Save" I create a worksheet chart, place colored rectangles in the chart, resize the chart using a points-to-pixels conversion, and export it to a .png image with transparency.

Everything is working perfectly, except I can't get my rectangles to appear flush with the chart edges. I position the upper left rectangle at 0,0,32,32, but it's always 5 pixels from the top and 5 pixels from the left. (And there's a 1 pixel gap on the right and bottom.)

Here's what my resulting image looks like:

saved_image.jpg

Any suggestions on how to fix this? I've tried everything and I'm going nuts!