How to capture panorama using scene capture cube and save it as image?

Its the different thing because they are saving rendered video of 360 video or pics, but i want to save the image in side my app, i am building the application for html5, like when i click the the button it creates the panorama image of room and saves the image in the hard drive.