Hi vishwasanj,
I encounter this issue as well. Share my solution with you although it may not a efficient way.
For simplicity I explain the X-axis(horizontal direction) only.
Given that a standard template Framebox size is 500, whole graph size is 535. That means we have size that not belongs to Framebox is 35.
Then, we have a graph generated by some of an for-loop, after assigning framesize=500, the wholesize=550.
Then, considering these graph will export as fixed total size png, if we have same framesize to wholesize ratio, we can have same frame size.
This is to say, we can add 'dx' to the previous graph to make the ratio same.
500:535=(500+dx):(550+dx+dx2),
where dx2 is axis length increase after dx is applied.
However, in my experience, dx2 is basically negilbible.
Thus, we can resize the 550 width pictures with frame size=500+dx, where
500:535=(500+dx):(550+dx).
After export as a similar size png, we can have same frame size pics.