maintaining pixel aspect ratio

I am rendering a 3D scene using a FBO object. I read the 3D scene using glReadPixels and convert the raw pixels into JPEG images. I want to maintain pixel aspect ratio in the JPEG images when the window containing the 3D scene changes size (eg. width, height are different as the user resizes the window). How can this be done? Appreciate any pointers.