Well, I guess they don't have to be exactly the same size... Sorry, didn't think of this.
It should be enoug if:
* top-left, top, and top-right have the same height
* top-left, left, and bottom-left have the same width
* top-right, right, and bottom-right have the same width
* bottom-left, bottom, and bottom-right have the same height
* top and bottom are as wide as center
* left and right are as high as center

(All the above points would be met if it's just a center image with a simple frame/border around it)

If you put sizes in the <img>-tagg to make the images confirm to the above points I think that would work as well